From 6f0ba6d91a2aa61d1b4332289e5940a728edb591 Mon Sep 17 00:00:00 2001 From: Justin Lu Date: Mon, 25 Mar 2024 08:35:16 -0700 Subject: [PATCH] Update support for crowdstrike_s2s posture rule --- .changelog/3216.txt | 3 +++ docs/resources/device_posture_rule.md | 2 ++ .../resource_cloudflare_device_posture_rule.go | 6 ++++++ .../schema_cloudflare_device_posture_rule.go | 11 +++++++++++ 4 files changed, 22 insertions(+) create mode 100644 .changelog/3216.txt diff --git a/.changelog/3216.txt b/.changelog/3216.txt new file mode 100644 index 0000000000..52bc4156e9 --- /dev/null +++ b/.changelog/3216.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/cloudflare_device_posture_rule: update support for new fields for crowdstrike_s2s posture rule. +``` \ No newline at end of file diff --git a/docs/resources/device_posture_rule.md b/docs/resources/device_posture_rule.md index a015d8d8ae..0e24c83a39 100644 --- a/docs/resources/device_posture_rule.md +++ b/docs/resources/device_posture_rule.md @@ -74,6 +74,7 @@ Optional: - `infected` (Boolean) True if SentinelOne device is infected. - `is_active` (Boolean) True if SentinelOne device is active. - `issue_count` (String) The number of issues for kolide. +- `last_seen` (String) The duration of time that the host was last seen from Crowdstrike. Must be in the format `1h` or `30m`. Valid units are `d`, `h` and `m`. - `network_status` (String) The network status from SentinelOne. Available values: `connected`, `disconnected`, `disconnecting`, `connecting`. - `operator` (String) The version comparison operator. Available values: `>`, `>=`, `<`, `<=`, `==`. - `os` (String) OS signal score from Crowdstrike. Value must be between 1 and 100. @@ -86,6 +87,7 @@ Optional: - `running` (Boolean) Checks if the application should be running. - `sensor_config` (String) Sensor signal score from Crowdstrike. Value must be between 1 and 100. - `sha256` (String) The sha256 hash of the file. +- `state` (String) The host’s current online status from Crowdstrike. Available values: `online`, `offline`, `unknown`. - `thumbprint` (String) The thumbprint of the file certificate. - `total_score` (Number) The total score from Tanium. - `version` (String) The operating system semantic version. diff --git a/internal/sdkv2provider/resource_cloudflare_device_posture_rule.go b/internal/sdkv2provider/resource_cloudflare_device_posture_rule.go index f31b997936..46910f4af4 100644 --- a/internal/sdkv2provider/resource_cloudflare_device_posture_rule.go +++ b/internal/sdkv2provider/resource_cloudflare_device_posture_rule.go @@ -222,6 +222,12 @@ func setDevicePostureRuleInput(rule *cloudflare.DevicePostureRule, d *schema.Res if versionOperator, ok := d.GetOk("input.0.version_operator"); ok { input.VersionOperator = versionOperator.(string) } + if state, ok := d.GetOk("input.0.state"); ok { + input.State = state.(string) + } + if last_seen, ok := d.GetOk("input.0.last_seen"); ok { + input.LastSeen = last_seen.(string) + } if countOperator, ok := d.GetOk("input.0.count_operator"); ok { input.CountOperator = countOperator.(string) } diff --git a/internal/sdkv2provider/schema_cloudflare_device_posture_rule.go b/internal/sdkv2provider/schema_cloudflare_device_posture_rule.go index 5cb52b2a8e..2d014f1b9a 100644 --- a/internal/sdkv2provider/schema_cloudflare_device_posture_rule.go +++ b/internal/sdkv2provider/schema_cloudflare_device_posture_rule.go @@ -175,6 +175,17 @@ func resourceCloudflareDevicePostureRuleSchema() map[string]*schema.Schema { ValidateFunc: validation.StringInSlice([]string{">", ">=", "<", "<=", "=="}, true), Description: fmt.Sprintf("The version comparison operator for crowdstrike. %s", renderAvailableDocumentationValuesStringSlice([]string{">", ">=", "<", "<=", "=="})), }, + "last_seen": { + Type: schema.TypeString, + Optional: true, + Description: "The duration of time that the host was last seen from Crowdstrike. Must be in the format `1h` or `30m`. Valid units are `d`, `h` and `m`.", + }, + "state": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"online", "offline", "unknown"}, true), + Description: fmt.Sprintf("The host’s current online status from Crowdstrike. %s", renderAvailableDocumentationValuesStringSlice([]string{"online", "offline", "unknown"})), + }, "count_operator": { Type: schema.TypeString, Optional: true,