-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add org account mappings to awls org scanning resource
- Loading branch information
Showing
4 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
integration/resource_lacework_integration_aws_org_agentless_scanning_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TestIntegrationAwsAgentlessScanningLog applies integration terraform: | ||
// => '../examples/resource_lacework_integration_aws_agentless_scanning' | ||
// | ||
// It uses the go-sdk to verify the created integration, | ||
// applies an update with new integration name and destroys it | ||
// nolint | ||
|
||
func TestIntegrationAwsOrgAgentlessScanningLog(t *testing.T) { | ||
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ | ||
TerraformDir: "../examples/resource_lacework_integration_aws_org_agentless_scanning", | ||
Vars: map[string]interface{}{ | ||
"name": "AWS Org Agentless Scanning created by terraform", | ||
"role_arn": "arn:aws:iam::249446771485:role/lacework-iam-example-role", | ||
"external_id": "12345", | ||
"org_account_mappings": []map[string]interface{}{ | ||
{ | ||
"default_lacework_account": "customerdemo", | ||
"integration_mappings": []map[string]interface{}{ | ||
{ | ||
"lacework_account": "abc", | ||
"aws_accounts": []string{"327958430571"}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
||
defer terraform.Destroy(t, terraformOptions) | ||
|
||
// Create new AWS Agentless Scanning Integration | ||
create := terraform.InitAndApplyAndIdempotent(t, terraformOptions) | ||
createData := GetAwsAgentlessOrgScanningResponse(create) | ||
println(create) | ||
actualName := terraform.Output(t, terraformOptions, "name") | ||
assert.Equal( | ||
t, | ||
"AWS Org Agentless Scanning created by terraform", | ||
GetCloudOrgAccountIntegrationName(create), | ||
) | ||
assert.Equal(t, "AWS Org Agentless Scanning created by terraform", createData.Data.Name) | ||
assert.Equal(t, "AWS Org Agentless Scanning created by terraform", actualName) | ||
|
||
// Update AWS Agentless Scanning Integration | ||
terraformOptions.Vars = map[string]interface{}{ | ||
"name": "AWS Org Agentless Scanning updated by terraform", | ||
"role_arn": "arn:aws:iam::249446771485:role/lacework-iam-example-role", | ||
"external_id": "12345", | ||
"org_account_mappings": []map[string]interface{}{ | ||
{ | ||
"default_lacework_account": "customerdemo", | ||
"integration_mappings": []map[string]interface{}{ | ||
{ | ||
"lacework_account": "abc", | ||
"aws_accounts": []string{"327958430571"}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
update := terraform.ApplyAndIdempotent(t, terraformOptions) | ||
updateData := GetAwsAgentlessOrgScanningResponse(update) | ||
actualName = terraform.Output(t, terraformOptions, "name") | ||
assert.Equal( | ||
t, | ||
"AWS Org Agentless Scanning updated by terraform", | ||
GetCloudOrgAccountIntegrationName(update), | ||
) | ||
assert.Equal(t, "AWS Org Agentless Scanning updated by terraform", updateData.Data.Name) | ||
assert.Equal(t, "AWS Org Agentless Scanning updated by terraform", actualName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters