Skip to content

Commit 48ebd17

Browse files
committed
Fixed test.
1 parent a69db81 commit 48ebd17

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed

sysdig/resource_sysdig_secure_cloud_auth_account_test.go

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -84,33 +84,6 @@ func TestAccGCPSecureCloudAuthAccountConfigPosture(t *testing.T) {
8484
})
8585
}
8686

87-
func TestAccAWSSecureCloudAuthAccountResponseActions(t *testing.T) {
88-
rText := func() string { return acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) }
89-
accID := rText()
90-
resource.ParallelTest(t, resource.TestCase{
91-
PreCheck: func() {
92-
if v := os.Getenv("SYSDIG_SECURE_API_TOKEN"); v == "" {
93-
t.Fatal("SYSDIG_SECURE_API_TOKEN must be set for acceptance tests")
94-
}
95-
},
96-
ProviderFactories: map[string]func() (*schema.Provider, error){
97-
"sysdig": func() (*schema.Provider, error) {
98-
return sysdig.Provider(), nil
99-
},
100-
},
101-
Steps: []resource.TestStep{
102-
{
103-
Config: secureAWSCloudAuthAccountWithResponseActions(accID),
104-
},
105-
{
106-
ResourceName: "sysdig_secure_cloud_auth_account.aws_response_actions",
107-
ImportState: true,
108-
ImportStateVerify: true,
109-
},
110-
},
111-
})
112-
}
113-
11487
func secureGCPCloudAuthAccountWithConfigPosture(accountID string) string {
11588
return fmt.Sprintf(`
11689
resource "sysdig_secure_cloud_auth_account" "gcp_config_posture" {
@@ -162,49 +135,6 @@ resource "sysdig_secure_cloud_auth_account" "gcp_config_posture" {
162135
`, accountID, getEncodedServiceAccountKey("gcp-cspm-test", accountID))
163136
}
164137

165-
func secureAWSCloudAuthAccountWithResponseActions(accountID string) string {
166-
return fmt.Sprintf(`
167-
resource "sysdig_secure_cloud_auth_account" "aws_response_actions" {
168-
provider_id = "aws-cspm-test-%s"
169-
provider_type = "PROVIDER_AWS"
170-
enabled = true
171-
feature {
172-
secure_response_actions {
173-
enabled = true
174-
components = ["COMPONENT_CLOUD_RESPONDER/cloud-responder", "COMPONENT_CLOUD_RESPONDER_ROLES/cloud-responder"]
175-
}
176-
}
177-
178-
component {
179-
type = "COMPONENT_CLOUD_RESPONDER"
180-
instance = "cloud-responder"
181-
cloud_responder_metadata = jsonencode({
182-
aws = {
183-
responder_lambdas = {
184-
lambda_names = ["l1", "l2", "l3"]
185-
regions = ["us-east-1", "eu-west-1"]
186-
delegate_role_name = "sysdig-delegate-role"
187-
}
188-
}
189-
}
190-
)
191-
}
192-
193-
component {
194-
type = "COMPONENT_CLOUD_RESPONDER_ROLES"
195-
instance = "cloud-responder"
196-
cloud_responder_roles_metadata = jsonencode({
197-
roles = [
198-
{aws = {role_name: "role1"}},
199-
{aws = {role_name: "role2"}},
200-
{aws = {role_name: "role3"}}
201-
]
202-
})
203-
}
204-
}
205-
`, accountID)
206-
}
207-
208138
func TestAccGCPSecureCloudAuthAccountAgentlesScanning(t *testing.T) {
209139
rText := func() string { return acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) }
210140
accID := rText()
@@ -620,6 +550,33 @@ func secureAzureCloudAuthAccountWithThreatDetection(accountID string) string {
620550
/************
621551
* AWS tests
622552
************/
553+
func TestAccAWSSecureCloudAuthAccountResponseActions(t *testing.T) {
554+
accountID := fmt.Sprintf("%012d", rand.Intn(99999999999))
555+
resource.ParallelTest(t, resource.TestCase{
556+
PreCheck: func() {
557+
if v := os.Getenv("SYSDIG_SECURE_API_TOKEN"); v == "" {
558+
t.Fatal("SYSDIG_SECURE_API_TOKEN must be set for acceptance tests")
559+
}
560+
},
561+
ProviderFactories: map[string]func() (*schema.Provider, error){
562+
"sysdig": func() (*schema.Provider, error) {
563+
return sysdig.Provider(), nil
564+
},
565+
},
566+
Steps: []resource.TestStep{
567+
{
568+
Config: secureAWSCloudAuthAccountWithResponseActions(accountID),
569+
},
570+
{
571+
ResourceName: "sysdig_secure_cloud_auth_account.aws_response_actions",
572+
ImportState: true,
573+
ImportStateVerify: true,
574+
},
575+
},
576+
})
577+
578+
}
579+
623580
func TestAccAWSSecureCloudAccountThreatDetection(t *testing.T) {
624581
accountID := fmt.Sprintf("%012d", rand.Intn(99999999999))
625582
resource.ParallelTest(t, resource.TestCase{
@@ -746,6 +703,49 @@ func TestAccAWSSecureCloudAccountConfigPostureAndAgentlessScanning(t *testing.T)
746703
})
747704
}
748705

706+
func secureAWSCloudAuthAccountWithResponseActions(accountID string) string {
707+
return fmt.Sprintf(`
708+
resource "sysdig_secure_cloud_auth_account" "aws_response_actions_%[1]s" {
709+
provider_id = "aws-cspm-test-%[1]s"
710+
provider_type = "PROVIDER_AWS"
711+
enabled = true
712+
feature {
713+
secure_response_actions {
714+
enabled = true
715+
components = ["COMPONENT_CLOUD_RESPONDER/cloud-responder", "COMPONENT_CLOUD_RESPONDER_ROLES/cloud-responder"]
716+
}
717+
}
718+
719+
component {
720+
type = "COMPONENT_CLOUD_RESPONDER"
721+
instance = "cloud-responder"
722+
cloud_responder_metadata = jsonencode({
723+
aws = {
724+
responder_lambdas = {
725+
lambda_names = ["l1", "l2", "l3"]
726+
regions = ["us-east-1", "eu-west-1"]
727+
delegate_role_name = "sysdig-delegate-role"
728+
}
729+
}
730+
}
731+
)
732+
}
733+
734+
component {
735+
type = "COMPONENT_CLOUD_RESPONDER_ROLES"
736+
instance = "cloud-responder"
737+
cloud_responder_roles_metadata = jsonencode({
738+
roles = [
739+
{aws = {role_name: "role1"}},
740+
{aws = {role_name: "role2"}},
741+
{aws = {role_name: "role3"}}
742+
]
743+
})
744+
}
745+
}
746+
`, accountID)
747+
}
748+
749749
/*************
750750
* Oracle tests
751751
*************/

0 commit comments

Comments
 (0)