Skip to content

Commit 4ca919a

Browse files
add agentless scanning attributes to cloud_aws_account (#169)
1 parent 74cc052 commit 4ca919a

File tree

16 files changed

+924
-200
lines changed

16 files changed

+924
-200
lines changed

docs/data-sources/cloud_aws_account.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Read-Only:
7373

7474
- `account_id` (String) The AWS Account ID
7575
- `account_type` (String) The AWS account type. Value is 'commercial' for Commercial cloud accounts. For GovCloud environments, value can be either 'commercial' or 'gov' depending on the account type
76+
- `agentless_scanning_role_name` (String) The name of the IAM role to be used by CrowdStrike Agentless Scanning (DSPM/Vulnerability scanning). If both are configured, the DSPM role takes precedence.
7677
- `asset_inventory_enabled` (Boolean) Whether asset inventory is enabled
7778
- `cloudtrail_bucket_name` (String) The name of the CloudTrail S3 bucket used for real-time visibility
7879
- `cloudtrail_region` (String) The AWS region of the CloudTrail bucket
@@ -91,3 +92,6 @@ Read-Only:
9192
- `realtime_visibility_enabled` (Boolean) Whether real-time visibility is enabled
9293
- `sensor_management_enabled` (Boolean) Whether 1-click sensor deployment is enabled
9394
- `target_ous` (List of String) The list of AWS Organizational Units (OUs) targeted for this account
95+
- `vulnerability_scanning_enabled` (Boolean) Whether Vulnerability Scanning is enabled
96+
- `vulnerability_scanning_role_arn` (String) The ARN of the IAM role to be used by CrowdStrike Vulnerability Scanning
97+
- `vulnerability_scanning_role_name` (String) The name of the IAM role to be used by CrowdStrike Vulnerability Scanning

docs/resources/cloud_aws_account.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ resource "crowdstrike_cloud_aws_account" "org" {
4848
enabled = true
4949
}
5050
51+
vulnerability_scanning = {
52+
enabled = true
53+
}
54+
5155
idp = {
5256
enabled = true
5357
}
@@ -78,9 +82,11 @@ resource "crowdstrike_cloud_aws_account" "org" {
7882
- `resource_name_suffix` (String) The suffix to be added to all resource names
7983
- `sensor_management` (Attributes) (see [below for nested schema](#nestedatt--sensor_management))
8084
- `target_ous` (List of String) The list of target Organizational Units
85+
- `vulnerability_scanning` (Attributes) (see [below for nested schema](#nestedatt--vulnerability_scanning))
8186

8287
### Read-Only
8388

89+
- `agentless_scanning_role_name` (String) The name of the IAM role to be used by CrowdStrike Agentless Scanning (DSPM/Vulnerability scanning). If both are configured, the DSPM role takes precedence.
8490
- `cloudtrail_bucket_name` (String) The name of the CloudTrail S3 bucket used for real-time visibility
8591
- `dspm_role_arn` (String) The ARN of the IAM role to be used by CrowdStrike Data Security Posture Management
8692
- `dspm_role_name` (String) The name of the IAM role to be used by CrowdStrike Data Security Posture Management
@@ -91,6 +97,8 @@ resource "crowdstrike_cloud_aws_account" "org" {
9197
- `iam_role_name` (String) The name of the AWS IAM role used to access this AWS account
9298
- `intermediate_role_arn` (String) The ARN of the intermediate role used to assume the AWS IAM role
9399
- `is_organization_management_account` (Boolean) Indicates whether this is the management account (formerly known as the root account) of an AWS Organization
100+
- `vulnerability_scanning_role_arn` (String) The ARN of the IAM role to be used by CrowdStrike Vulnerability Scanning
101+
- `vulnerability_scanning_role_name` (String) The name of the IAM role to be used by CrowdStrike Vulnerability Scanning
94102

95103
<a id="nestedatt--asset_inventory"></a>
96104
### Nested Schema for `asset_inventory`
@@ -148,6 +156,18 @@ Required:
148156

149157
- `enabled` (Boolean) Enable 1-click sensor deployment
150158

159+
160+
<a id="nestedatt--vulnerability_scanning"></a>
161+
### Nested Schema for `vulnerability_scanning`
162+
163+
Required:
164+
165+
- `enabled` (Boolean) Enable Vulnerability Scanning
166+
167+
Optional:
168+
169+
- `role_name` (String) Custom AWS IAM role name for Vulnerability Scanning
170+
151171
## Import
152172

153173
Import is supported using the following syntax:

examples/resources/crowdstrike_cloud_aws_account/resource.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ resource "crowdstrike_cloud_aws_account" "org" {
2323
enabled = true
2424
}
2525

26+
vulnerability_scanning = {
27+
enabled = true
28+
}
29+
2630
idp = {
2731
enabled = true
2832
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/crowdstrike/terraform-provider-crowdstrike
33
go 1.24.0
44

55
require (
6-
github.com/crowdstrike/gofalcon v0.18.1-0.20251101020249-526ce85b6da7
6+
github.com/crowdstrike/gofalcon v0.18.1-0.20251111154050-6f6d1fc5d8ab
77
github.com/google/go-cmp v0.6.0
88
github.com/hashicorp/go-version v1.7.0
99
github.com/hashicorp/terraform-plugin-docs v0.19.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZ
3333
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
3434
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
3535
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
36-
github.com/crowdstrike/gofalcon v0.18.1-0.20251101020249-526ce85b6da7 h1:1GPpMt44VamS7a9nyiZdsRJPgl5pyTY3xyOvP+joFJg=
37-
github.com/crowdstrike/gofalcon v0.18.1-0.20251101020249-526ce85b6da7/go.mod h1:a12GB+md+hRSgVCb3Pv6CakeTIsDIUCIVWRlJelIhY0=
36+
github.com/crowdstrike/gofalcon v0.18.1-0.20251111154050-6f6d1fc5d8ab h1:mSFSsRaHZTvM7TfAaFKuIbMwWbuyQmHzzcPYOZLKaOo=
37+
github.com/crowdstrike/gofalcon v0.18.1-0.20251111154050-6f6d1fc5d8ab/go.mod h1:a12GB+md+hRSgVCb3Pv6CakeTIsDIUCIVWRlJelIhY0=
3838
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
3939
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
4040
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

internal/cloud_security/custom_rule_resource_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cloudsecurity_test
22

33
import (
44
"fmt"
5+
"os"
56
"regexp"
67
"strings"
78
"testing"
@@ -12,6 +13,17 @@ import (
1213
"github.com/hashicorp/terraform-plugin-testing/terraform"
1314
)
1415

16+
// skipIfRegoNotEnabled skips the test if the ENABLE_REGO_TESTS environment variable is not set.
17+
// This is used for tests that use custom Rego logic, which requires the custom policy feature
18+
// flag to be enabled in the CrowdStrike environment.
19+
//
20+
// To enable these tests, set: export ENABLE_REGO_TESTS=1
21+
func skipIfRegoNotEnabled(t *testing.T) {
22+
if os.Getenv("ENABLE_REGO_TESTS") == "" {
23+
t.Skip("Skipping test: ENABLE_REGO_TESTS environment variable not set. These tests require the custom policy feature flag to be enabled for your CID.")
24+
}
25+
}
26+
1527
type ruleBaseConfig struct {
1628
ruleNamePrefix string
1729
description []string
@@ -122,6 +134,7 @@ func TestCloudSecurityCustomRuleResource_AWS_Copy(t *testing.T) {
122134
}
123135

124136
func TestCloudSecurityCustomRuleResource_AWS_Rego(t *testing.T) {
137+
skipIfRegoNotEnabled(t)
125138
resource.ParallelTest(t, resource.TestCase{
126139
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
127140
PreCheck: func() { acctest.PreCheck(t) },
@@ -138,6 +151,7 @@ func TestCloudSecurityCustomRuleResource_AWS_Minimal(t *testing.T) {
138151
}
139152

140153
func TestCloudSecurityCustomRuleResource_AWS_MinimalRego(t *testing.T) {
154+
skipIfRegoNotEnabled(t)
141155
resource.ParallelTest(t, resource.TestCase{
142156
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
143157
PreCheck: func() { acctest.PreCheck(t) },
@@ -154,6 +168,7 @@ func TestCloudSecurityCustomRuleResource_AWS_DefinedToOmitted(t *testing.T) {
154168
}
155169

156170
func TestCloudSecurityCustomRuleResource_AWS_RegoDefinedToOmitted(t *testing.T) {
171+
skipIfRegoNotEnabled(t)
157172
resource.ParallelTest(t, resource.TestCase{
158173
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
159174
PreCheck: func() { acctest.PreCheck(t) },
@@ -162,6 +177,7 @@ func TestCloudSecurityCustomRuleResource_AWS_RegoDefinedToOmitted(t *testing.T)
162177
}
163178

164179
func TestCloudSecurityCustomRuleResource_AWS_RegoDefinedToEmpty(t *testing.T) {
180+
skipIfRegoNotEnabled(t)
165181
resource.ParallelTest(t, resource.TestCase{
166182
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
167183
PreCheck: func() { acctest.PreCheck(t) },
@@ -211,6 +227,7 @@ func TestCloudSecurityCustomRuleResource_Azure_Copy(t *testing.T) {
211227
}
212228

213229
func TestCloudSecurityCustomRuleResource_Azure_Rego(t *testing.T) {
230+
skipIfRegoNotEnabled(t)
214231
resource.ParallelTest(t, resource.TestCase{
215232
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
216233
PreCheck: func() { acctest.PreCheck(t) },
@@ -227,6 +244,7 @@ func TestCloudSecurityCustomRuleResource_Azure_Minimal(t *testing.T) {
227244
}
228245

229246
func TestCloudSecurityCustomRuleResource_Azure_MinimalRego(t *testing.T) {
247+
skipIfRegoNotEnabled(t)
230248
resource.ParallelTest(t, resource.TestCase{
231249
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
232250
PreCheck: func() { acctest.PreCheck(t) },
@@ -243,6 +261,7 @@ func TestCloudSecurityCustomRuleResource_Azure_DefinedToOmitted(t *testing.T) {
243261
}
244262

245263
func TestCloudSecurityCustomRuleResource_Azure_RegoDefinedToOmitted(t *testing.T) {
264+
skipIfRegoNotEnabled(t)
246265
resource.ParallelTest(t, resource.TestCase{
247266
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
248267
PreCheck: func() { acctest.PreCheck(t) },
@@ -251,6 +270,7 @@ func TestCloudSecurityCustomRuleResource_Azure_RegoDefinedToOmitted(t *testing.T
251270
}
252271

253272
func TestCloudSecurityCustomRuleResource_Azure_RegoDefinedToEmpty(t *testing.T) {
273+
skipIfRegoNotEnabled(t)
254274
resource.ParallelTest(t, resource.TestCase{
255275
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
256276
PreCheck: func() { acctest.PreCheck(t) },
@@ -300,6 +320,7 @@ func TestCloudSecurityCustomRuleResource_GCP_Copy(t *testing.T) {
300320
}
301321

302322
func TestCloudSecurityCustomRuleResource_GCP_Rego(t *testing.T) {
323+
skipIfRegoNotEnabled(t)
303324
resource.ParallelTest(t, resource.TestCase{
304325
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
305326
PreCheck: func() { acctest.PreCheck(t) },
@@ -316,6 +337,7 @@ func TestCloudSecurityCustomRuleResource_GCP_Minimal(t *testing.T) {
316337
}
317338

318339
func TestCloudSecurityCustomRuleResource_GCP_MinimalRego(t *testing.T) {
340+
skipIfRegoNotEnabled(t)
319341
resource.ParallelTest(t, resource.TestCase{
320342
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
321343
PreCheck: func() { acctest.PreCheck(t) },
@@ -332,6 +354,7 @@ func TestCloudSecurityCustomRuleResource_GCP_DefinedToOmitted(t *testing.T) {
332354
}
333355

334356
func TestCloudSecurityCustomRuleResource_GCP_RegoDefinedToOmitted(t *testing.T) {
357+
skipIfRegoNotEnabled(t)
335358
resource.ParallelTest(t, resource.TestCase{
336359
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
337360
PreCheck: func() { acctest.PreCheck(t) },
@@ -340,6 +363,7 @@ func TestCloudSecurityCustomRuleResource_GCP_RegoDefinedToOmitted(t *testing.T)
340363
}
341364

342365
func TestCloudSecurityCustomRuleResource_GCP_RegoDefinedToEmpty(t *testing.T) {
366+
skipIfRegoNotEnabled(t)
343367
resource.ParallelTest(t, resource.TestCase{
344368
ProtoV6ProviderFactories: acctest.ProtoV6ProviderFactories,
345369
PreCheck: func() { acctest.PreCheck(t) },

0 commit comments

Comments
 (0)