Skip to content

Commit 4d9d1d3

Browse files
authored
test(cloudauth): ciem webhook (#501)
* update CIEM tests to leverage webhook with embedded SP
1 parent 2f178ca commit 4d9d1d3

File tree

2 files changed

+74
-29
lines changed

2 files changed

+74
-29
lines changed

sysdig/resource_sysdig_secure_cloud_auth_account_test.go

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,46 @@ resource "sysdig_secure_cloud_auth_account" "gcp_config_posture" {
9191
provider_type = "PROVIDER_GCP"
9292
enabled = true
9393
feature {
94-
secure_config_posture {
95-
enabled = true
96-
components = ["COMPONENT_SERVICE_PRINCIPAL/secure-posture"]
97-
}
98-
secure_identity_entitlement {
99-
enabled = true
100-
components = ["COMPONENT_SERVICE_PRINCIPAL/secure-posture"]
101-
}
94+
secure_config_posture {
95+
enabled = true
96+
components = ["COMPONENT_SERVICE_PRINCIPAL/secure-posture"]
97+
}
98+
secure_identity_entitlement {
99+
enabled = true
100+
components = ["COMPONENT_WEBHOOK_DATASOURCE/secure-runtime"]
101+
}
102102
}
103103
component {
104-
type = "COMPONENT_SERVICE_PRINCIPAL"
105-
instance = "secure-posture"
106-
service_principal_metadata = jsonencode({
104+
type = "COMPONENT_SERVICE_PRINCIPAL"
105+
instance = "secure-posture"
106+
service_principal_metadata = jsonencode({
107107
gcp = {
108108
key = "%s"
109109
}
110110
})
111111
}
112+
component {
113+
type = "COMPONENT_WEBHOOK_DATASOURCE"
114+
instance = "secure-runtime"
115+
webhook_datasource_metadata = jsonencode({
116+
gcp = {
117+
webhook_datasource = {
118+
pubsub_topic_name = "pubsub_topic_name_value"
119+
sink_name = "sink_name_value"
120+
push_subscription_name = "push_subscription_name_value"
121+
push_endpoint = "push_endpoint_value"
122+
}
123+
service_principal = {
124+
workload_identity_federation = {
125+
pool_id = "pool_id_value"
126+
pool_provider_id = "pool_provider_id_value"
127+
project_number = "123456789011"
128+
}
129+
email = "email_value"
130+
}
131+
}
132+
})
133+
}
112134
}
113135
`, accountID, getEncodedServiceAccountKey("gcp-cspm-test", accountID))
114136
}

sysdig/resource_sysdig_secure_organization_test.go

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import (
77
b64 "encoding/base64"
88
"encoding/json"
99
"fmt"
10-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
11-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
12-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1310
"os"
1411
"regexp"
1512
"testing"
1613

14+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
15+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
16+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
17+
1718
"github.com/draios/terraform-provider-sysdig/sysdig"
1819
)
1920

@@ -68,33 +69,55 @@ resource "sysdig_secure_cloud_auth_account" "sample" {
6869
provider_type = "PROVIDER_GCP"
6970
enabled = "true"
7071
feature {
71-
secure_config_posture {
72-
enabled = "true"
73-
components = ["COMPONENT_SERVICE_PRINCIPAL/secure-posture"]
74-
}
75-
secure_identity_entitlement {
76-
enabled = true
77-
components = ["COMPONENT_SERVICE_PRINCIPAL/secure-posture"]
78-
}
72+
secure_config_posture {
73+
enabled = true
74+
components = ["COMPONENT_SERVICE_PRINCIPAL/secure-posture"]
75+
}
76+
secure_identity_entitlement {
77+
enabled = true
78+
components = ["COMPONENT_WEBHOOK_DATASOURCE/secure-runtime"]
79+
}
7980
}
8081
component {
81-
type = "COMPONENT_SERVICE_PRINCIPAL"
82-
instance = "secure-posture"
83-
service_principal_metadata = jsonencode({
82+
type = "COMPONENT_SERVICE_PRINCIPAL"
83+
instance = "secure-posture"
84+
service_principal_metadata = jsonencode({
8485
gcp = {
8586
key = "%s"
8687
}
8788
})
8889
}
89-
component {
90-
type = "COMPONENT_SERVICE_PRINCIPAL"
91-
instance = "secure-onboarding"
92-
service_principal_metadata = jsonencode({
90+
component {
91+
type = "COMPONENT_SERVICE_PRINCIPAL"
92+
instance = "secure-onboarding"
93+
service_principal_metadata = jsonencode({
9394
gcp = {
9495
key = "%s"
9596
}
9697
})
9798
}
99+
component {
100+
type = "COMPONENT_WEBHOOK_DATASOURCE"
101+
instance = "secure-runtime"
102+
webhook_datasource_metadata = jsonencode({
103+
gcp = {
104+
webhook_datasource = {
105+
pubsub_topic_name = "pubsub_topic_name_value"
106+
sink_name = "sink_name_value"
107+
push_subscription_name = "push_subscription_name_value"
108+
push_endpoint = "push_endpoint_value"
109+
}
110+
service_principal = {
111+
workload_identity_federation = {
112+
pool_id = "pool_id_value"
113+
pool_provider_id = "pool_provider_id_value"
114+
project_number = "123456789011"
115+
}
116+
email = "email_value"
117+
}
118+
}
119+
})
120+
}
98121
}
99122
resource "sysdig_secure_organization" "sample-org" {
100123
management_account_id = sysdig_secure_cloud_auth_account.sample.id

0 commit comments

Comments
 (0)