Skip to content

Commit

Permalink
test(team_members): use lwdomain to get correct account name (#272)
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Murray <darren.murray@lacework.net>
  • Loading branch information
dmurray-lacework authored Feb 23, 2022
1 parent 1650b9f commit e120def
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions integration/resource_lacework_team_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/lacework/go-sdk/lwdomain"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit e120def

Please sign in to comment.