From e120def7f14f533b867fe904610c906ec5168d1e Mon Sep 17 00:00:00 2001 From: Darren <75614232+dmurray-lacework@users.noreply.github.com> Date: Wed, 23 Feb 2022 07:46:15 +0000 Subject: [PATCH] test(team_members): use lwdomain to get correct account name (#272) Signed-off-by: Darren Murray --- integration/resource_lacework_team_member_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/integration/resource_lacework_team_member_test.go b/integration/resource_lacework_team_member_test.go index cbb4b72e..93fef699 100644 --- a/integration/resource_lacework_team_member_test.go +++ b/integration/resource_lacework_team_member_test.go @@ -7,6 +7,7 @@ import ( "time" "github.com/gruntwork-io/terratest/modules/terraform" + "github.com/lacework/go-sdk/lwdomain" "github.com/stretchr/testify/assert" ) @@ -55,13 +56,17 @@ func TestTeamMemberOrg(t *testing.T) { if os.Getenv("CI_STANDALONE_ACCOUNT") != "" { t.Skip("skipping organizational account test") } - + account := os.Getenv("LW_ACCOUNT") email := fmt.Sprintf("vatasha.white+%d@lacework.net", time.Now().Unix()) + + if domain, err := lwdomain.New(account); err == nil { + account = domain.Account + } terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/resource_lacework_team_member_organization", Vars: map[string]interface{}{ "email": email, - "user_accounts": []string{os.Getenv("LW_ACCOUNT")}, + "user_accounts": []string{account}, }, }) defer terraform.Destroy(t, terraformOptions) @@ -81,7 +86,7 @@ func TestTeamMemberOrg(t *testing.T) { // Update Org Team Member terraformOptions.Vars["first_name"] = "Shuri" terraformOptions.Vars["user_accounts"] = []string{} - terraformOptions.Vars["admin_accounts"] = []string{os.Getenv("LW_ACCOUNT")} + terraformOptions.Vars["admin_accounts"] = []string{account} update := terraform.ApplyAndIdempotent(t, terraformOptions) tmUpdate := GetOrgTeamMember(update)