diff --git a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/terraform.tfstate b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/terraform.tfstate index 4211397..11cc0a7 100644 --- a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/terraform.tfstate +++ b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/terraform.tfstate @@ -1,37 +1,17 @@ { - "version": 4, - "terraform_version": "1.15.0", - "serial": 15, + "check_results": null, "lineage": "2e525f2f-6f5f-a864-283c-e2b07953ecb4", "outputs": {}, "resources": [ { - "mode": "managed", - "type": "cloudflare_zero_trust_device_posture_rule", - "name": "basic", - "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", "instances": [ { - "schema_version": 0, "attributes": { - "id": "f1d0ab1b-2db2-4283-ab9c-b809faced013", "account_id": "f037e56e89293a057740de681ac9abbe", - "name": "tf-test-posture-basic", - "type": "os_version", "description": "Device posture rule for corporate devices.", - "schedule": "24h", "expiration": "24h", - "match": [ - { - "platform": "linux" - } - ], + "id": "f1d0ab1b-2db2-4283-ab9c-b809faced013", "input": { - "version": "1.0.0", - "operator": "<", - "os_distro_name": "ubuntu", - "os_distro_revision": "1.0.0", - "os_version_extra": "(a)", "active_threats": null, "certificate_id": null, "check_disks": null, @@ -53,7 +33,11 @@ "locations": null, "network_status": null, "operational_state": null, + "operator": "\u003c", "os": null, + "os_distro_name": "ubuntu", + "os_distro_revision": "1.0.0", + "os_version_extra": "(a)", "overall": null, "path": null, "require_all": null, @@ -64,44 +48,44 @@ "state": null, "thumbprint": null, "total_score": null, + "version": "1.0.0", "version_operator": null - } + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "tf-test-posture-basic", + "schedule": "24h", + "type": "os_version" }, - "sensitive_attributes": [], + "identity_schema_version": 0, "private": "bnVsbA==", - "identity_schema_version": 0 + "schema_version": 0, + "sensitive_attributes": [] } - ] - }, - { + ], "mode": "managed", - "type": "cloudflare_zero_trust_device_posture_rule", - "name": "disk_encryption", + "name": "basic", "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { "instances": [ { - "schema_version": 0, "attributes": { - "id": "10fd8575-3a0e-44c5-a771-73a2815a644c", "account_id": "f037e56e89293a057740de681ac9abbe", - "name": "tf-test-disk", - "type": "disk_encryption", "description": "", - "schedule": "5m", "expiration": "", - "match": [ - { - "platform": "windows" - } - ], + "id": "10fd8575-3a0e-44c5-a771-73a2815a644c", "input": { + "active_threats": null, + "certificate_id": null, "check_disks": [ "C:", "D:" ], - "require_all": true, - "active_threats": null, - "certificate_id": null, "check_private_key": null, "cn": null, "compliance_status": null, @@ -127,6 +111,7 @@ "os_version_extra": null, "overall": null, "path": null, + "require_all": true, "risk_level": null, "score": null, "sensor_config": null, @@ -136,37 +121,36 @@ "total_score": null, "version": null, "version_operator": null - } + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "tf-test-disk", + "schedule": "5m", + "type": "disk_encryption" }, - "sensitive_attributes": [], + "identity_schema_version": 0, "private": "bnVsbA==", - "identity_schema_version": 0 + "schema_version": 0, + "sensitive_attributes": [] } - ] - }, - { + ], "mode": "managed", - "type": "cloudflare_zero_trust_device_posture_rule", - "name": "firewall", + "name": "disk_encryption", "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { "instances": [ { - "schema_version": 0, "attributes": { - "id": "82648948-0bcc-49af-8b80-071e0bd69f6d", "account_id": "f037e56e89293a057740de681ac9abbe", - "name": "tf-test-firewall", - "type": "firewall", "description": "", - "schedule": "5m", "expiration": "", - "match": [ - { - "platform": "windows" - } - ], + "id": "82648948-0bcc-49af-8b80-071e0bd69f6d", "input": { - "enabled": true, "active_threats": null, "certificate_id": null, "check_disks": null, @@ -177,6 +161,7 @@ "count_operator": null, "domain": null, "eid_last_seen": null, + "enabled": true, "exists": null, "extended_key_usage": null, "id": null, @@ -204,30 +189,75 @@ "total_score": null, "version": null, "version_operator": null - } + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "tf-test-firewall", + "schedule": "5m", + "type": "firewall" }, - "sensitive_attributes": [], + "identity_schema_version": 0, "private": "bnVsbA==", - "identity_schema_version": 0 + "schema_version": 0, + "sensitive_attributes": [] } - ] - }, - { + ], "mode": "managed", - "type": "cloudflare_zero_trust_device_posture_rule", - "name": "multi_platform", + "name": "firewall", "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { "instances": [ { - "schema_version": 0, "attributes": { - "id": "91f41a4a-4dcb-4585-92cc-fe59dd78243b", "account_id": "f037e56e89293a057740de681ac9abbe", - "name": "tf-test-multi", - "type": "firewall", "description": "", - "schedule": "5m", "expiration": "", + "id": "91f41a4a-4dcb-4585-92cc-fe59dd78243b", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, "match": [ { "platform": "windows" @@ -239,8 +269,30 @@ "platform": "linux" } ], + "name": "tf-test-multi", + "schedule": "5m", + "type": "firewall" + }, + "identity_schema_version": 0, + "private": "bnVsbA==", + "schema_version": 0, + "sensitive_attributes": [] + } + ], + "mode": "managed", + "name": "multi_platform", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "", + "expiration": "", + "id": "c3d4e5f6-7890-abcd-ef12-3456789abcde", "input": { - "enabled": true, "active_threats": null, "certificate_id": null, "check_disks": null, @@ -251,6 +303,7 @@ "count_operator": null, "domain": null, "eid_last_seen": null, + "enabled": null, "exists": null, "extended_key_usage": null, "id": null, @@ -267,49 +320,113 @@ "os_distro_revision": null, "os_version_extra": null, "overall": null, - "path": null, + "path": "/usr/bin/security-app", "require_all": null, "risk_level": null, "score": null, "sensor_config": null, - "sha256": null, + "sha256": "abc123def456", "state": null, "thumbprint": null, "total_score": null, "version": null, "version_operator": null - } + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "tf-test-application", + "schedule": "30m", + "type": "application" }, - "sensitive_attributes": [], + "identity_schema_version": 0, "private": "bnVsbA==", - "identity_schema_version": 0 + "schema_version": 0, + "sensitive_attributes": [] } - ] - }, - { + ], "mode": "managed", - "type": "cloudflare_zero_trust_device_posture_rule", "name": "application", "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { "instances": [ { - "schema_version": 0, "attributes": { - "id": "c3d4e5f6-7890-abcd-ef12-3456789abcde", "account_id": "f037e56e89293a057740de681ac9abbe", - "name": "tf-test-application", - "type": "application", - "description": "", - "schedule": "30m", - "expiration": "", + "description": null, + "expiration": null, + "id": "c09290ea-94b8-4f1c-84f1-277ae9ecf604", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "\u003e=", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "20.4.0", + "version_operator": null + }, "match": [ { "platform": "linux" } ], + "name": "prod-posture-rule", + "schedule": "24h", + "type": "os_version" + }, + "index_key": "prod", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "a1570f0d-58b3-48bf-9c2b-83395788554b", "input": { - "path": "/usr/bin/security-app", - "sha256": "abc123def456", "active_threats": null, "certificate_id": null, "check_disks": null, @@ -320,7 +437,7 @@ "count_operator": null, "domain": null, "eid_last_seen": null, - "enabled": null, + "enabled": true, "exists": null, "extended_key_usage": null, "id": null, @@ -331,29 +448,1225 @@ "locations": null, "network_status": null, "operational_state": null, - "operator": null, + "operator": "", "os": null, "os_distro_name": null, "os_distro_revision": null, "os_version_extra": null, "overall": null, + "path": null, "require_all": null, "risk_level": null, "score": null, "sensor_config": null, + "sha256": null, "state": null, "thumbprint": null, "total_score": null, - "version": null, + "version": "", "version_operator": null - } + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "staging-posture-rule", + "schedule": "12h", + "type": "firewall" }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "identity_schema_version": 0 + "index_key": "staging", + "schema_version": 0 } - ] - } - ], - "check_results": null -} + ], + "mode": "managed", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "9c54bb0b-6725-4dce-80b8-9231c1223269", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "\u003e=", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "12.0.0", + "version_operator": null + }, + "match": [ + { + "platform": "mac" + } + ], + "name": "dev-posture-rule", + "schedule": "6h", + "type": "os_version" + }, + "index_key": "dev", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "6e4db720-298a-4c45-87fa-210cb8f99e71", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "qa-posture-rule", + "schedule": "12h", + "type": "firewall" + }, + "index_key": "qa", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "c391b7c3-8db9-41fa-a7ce-dc15d7c7779d", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "\u003e=", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "11.0.0", + "version_operator": null + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "perf-posture-rule", + "schedule": "24h", + "type": "os_version" + }, + "index_key": "perf", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "6711e891-6b36-4021-83ac-18feb8dc10b7", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "set-alpha-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "alpha", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "fa546ba6-a9dd-4582-b1ec-2c56e38daabd", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "set-beta-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "beta", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "34b63a00-077e-4cbe-8b46-e00c9e91893f", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "set-gamma-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "gamma", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "eb384a48-2305-47df-900b-473e851e7519", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "set-delta-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "delta", + "schema_version": 0 + } + ], + "mode": "managed", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "This is posture rule number 0", + "expiration": null, + "id": "9b6e9637-95ee-4968-9437-6e22e69eb275", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "==", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "1.0.0", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "counted-rule-0", + "schedule": "24h", + "type": "os_version" + }, + "index_key": 0, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "counted", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "This is posture rule number 1", + "expiration": null, + "id": "982829a5-db19-4a42-9118-1585c9e769e0", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "==", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "1.1.0", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "counted-rule-1", + "schedule": "24h", + "type": "os_version" + }, + "index_key": 1, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "counted", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "This is posture rule number 2", + "expiration": null, + "id": "23595eb4-40ae-4861-b0b4-31e6b71d41f9", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "==", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "1.2.0", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "counted-rule-2", + "schedule": "24h", + "type": "os_version" + }, + "index_key": 2, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "counted", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Conditionally enabled firewall rule", + "expiration": null, + "id": "bb367382-5f09-4e36-b66e-e3c617fe1a32", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "conditional-firewall-enabled", + "schedule": "12h", + "type": "firewall" + }, + "index_key": 0, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "conditional_enabled", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Rule for account f037e56e89293a057740de681ac9abbe", + "expiration": null, + "id": "e84f7d69-cf1b-4669-923d-209b22919a42", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "\u003e=", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "22.4.0", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "test-integration-function-example", + "schedule": "24h", + "type": "os_version" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "with_functions", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Interpolated rule name", + "expiration": null, + "id": "c966fc14-5ca2-42ae-924c-35098522249e", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "rule-for-account-f037e56e89293a057740de681ac9abbe", + "schedule": "5m", + "type": "firewall" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "with_interpolation", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Rule with lifecycle arguments", + "expiration": null, + "id": "e558b3ff-588a-41ee-8fd6-46aa704366db", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "\u003e=", + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "20.4.0", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "lifecycle-test-rule", + "schedule": "24h", + "type": "os_version" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "with_lifecycle", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "82abe08a-476e-490e-ab46-ef7300cbb53f", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "prevent-destroy-rule", + "schedule": "12h", + "type": "firewall" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "with_prevent_destroy", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "32a729fd-1e5c-45d6-be01-0755eb050b9d", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "minimal-rule", + "schedule": null, + "type": "firewall" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "minimal", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "All fields populated", + "expiration": "24h", + "id": "e17ca2c2-054d-4ad5-a05f-cf950dd462c6", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": null, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": "\u003e=", + "os": null, + "os_distro_name": "ubuntu", + "os_distro_revision": "22.4.0", + "os_version_extra": "(LTS)", + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": "22.4.0", + "version_operator": null + }, + "match": [ + { + "platform": "linux" + } + ], + "name": "maximal-rule", + "schedule": "24h", + "type": "os_version" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "maximal", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + }, + { + "instances": [ + { + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "998f1740-c25f-4f5e-896f-696e342be7f7", + "input": { + "active_threats": null, + "certificate_id": null, + "check_disks": null, + "check_private_key": null, + "cn": null, + "compliance_status": null, + "connection_id": null, + "count_operator": null, + "domain": null, + "eid_last_seen": null, + "enabled": true, + "exists": null, + "extended_key_usage": null, + "id": null, + "infected": null, + "is_active": null, + "issue_count": null, + "last_seen": null, + "locations": null, + "network_status": null, + "operational_state": null, + "operator": null, + "os": null, + "os_distro_name": null, + "os_distro_revision": null, + "os_version_extra": null, + "overall": null, + "path": null, + "require_all": null, + "risk_level": null, + "score": null, + "sensor_config": null, + "sha256": null, + "state": null, + "thumbprint": null, + "total_score": null, + "version": null, + "version_operator": null + }, + "match": [ + { + "platform": "windows" + } + ], + "name": "with-nulls", + "schedule": null, + "type": "firewall" + }, + "schema_version": 0 + } + ], + "mode": "managed", + "name": "with_nulls", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "type": "cloudflare_zero_trust_device_posture_rule" + } + ], + "serial": 16, + "terraform_version": "1.15.0", + "version": 4 +} \ No newline at end of file diff --git a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/zero_trust_device_posture_rule.tf b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/zero_trust_device_posture_rule.tf index 9076c63..f2f7c79 100644 --- a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/zero_trust_device_posture_rule.tf +++ b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/expected/zero_trust_device_posture_rule.tf @@ -8,6 +8,315 @@ variable "cloudflare_zone_id" { type = string } +# ============================================================================ +# Pattern Group 1: Variables & Locals +# ============================================================================ + +locals { + common_account = var.cloudflare_account_id + name_prefix = "test-integration" + default_schedule = "24h" + enable_firewall_rules = true + enable_test_rules = false +} + +# ============================================================================ +# Pattern Group 2: for_each with Maps (5 resources) +# ============================================================================ + +resource "cloudflare_zero_trust_device_posture_rule" "map_example" { + for_each = { + "prod" = { + account_id = var.cloudflare_account_id + name = "prod-posture-rule" + type = "os_version" + schedule = "24h" + platform = "linux" + version = "20.4.0" + } + "staging" = { + account_id = var.cloudflare_account_id + name = "staging-posture-rule" + type = "firewall" + schedule = "12h" + platform = "windows" + version = "10.0.0" + } + "dev" = { + account_id = var.cloudflare_account_id + name = "dev-posture-rule" + type = "os_version" + schedule = "6h" + platform = "mac" + version = "12.0.0" + } + "qa" = { + account_id = var.cloudflare_account_id + name = "qa-posture-rule" + type = "firewall" + schedule = "12h" + platform = "linux" + version = "1.0.0" + } + "perf" = { + account_id = var.cloudflare_account_id + name = "perf-posture-rule" + type = "os_version" + schedule = "24h" + platform = "windows" + version = "11.0.0" + } + } + + account_id = each.value.account_id + name = each.value.name + type = each.value.type + schedule = each.value.schedule + + + input = { + version = each.value.version + operator = ">=" + } +} + +# ============================================================================ +# Pattern Group 3: for_each with Sets (4 items) +# ============================================================================ + +resource "cloudflare_zero_trust_device_posture_rule" "set_example" { + for_each = toset([ + "alpha", + "beta", + "gamma", + "delta" + ]) + + account_id = var.cloudflare_account_id + name = "set-${each.value}-rule" + type = "firewall" + schedule = "5m" + + + input = { + enabled = true + } + match = [{ + platform = "linux" + }] +} + +# ============================================================================ +# Pattern Group 4: count-based Resources (3 instances) +# ============================================================================ + +resource "cloudflare_zero_trust_device_posture_rule" "counted" { + count = 3 + + account_id = var.cloudflare_account_id + name = "counted-rule-${count.index}" + type = "os_version" + schedule = "24h" + description = "This is posture rule number ${count.index}" + + + input = { + version = "1.${count.index}.0" + operator = "==" + } + match = [{ + platform = "linux" + }] +} + +# ============================================================================ +# Pattern Group 5: Conditional Creation +# ============================================================================ + +resource "cloudflare_zero_trust_device_posture_rule" "conditional_enabled" { + count = local.enable_firewall_rules ? 1 : 0 + + account_id = var.cloudflare_account_id + name = "conditional-firewall-enabled" + type = "firewall" + schedule = "12h" + description = "Conditionally enabled firewall rule" + + + input = { + enabled = true + } + match = [{ + platform = "windows" + }] +} + +resource "cloudflare_zero_trust_device_posture_rule" "conditional_disabled" { + count = local.enable_test_rules ? 1 : 0 + + account_id = var.cloudflare_account_id + name = "conditional-test-disabled" + type = "os_version" + schedule = "6h" + description = "Conditionally disabled test rule" + + + input = { + version = "1.0.0" + operator = ">" + } + match = [{ + platform = "linux" + }] +} + +# ============================================================================ +# Pattern Group 7: Terraform Functions +# ============================================================================ + +resource "cloudflare_zero_trust_device_posture_rule" "with_functions" { + account_id = local.common_account + + # join() function + name = join("-", [local.name_prefix, "function", "example"]) + + type = "os_version" + schedule = local.default_schedule + description = "Rule for account ${var.cloudflare_account_id}" + + + input = { + version = "22.4.0" + operator = ">=" + } + match = [{ + platform = "linux" + }] +} + +resource "cloudflare_zero_trust_device_posture_rule" "with_interpolation" { + account_id = var.cloudflare_account_id + name = "rule-for-account-${var.cloudflare_account_id}" + type = "firewall" + schedule = "5m" + description = "Interpolated rule name" + + + input = { + enabled = true + } + match = [{ + platform = "windows" + }] +} + +# ============================================================================ +# Pattern Group 8: Lifecycle Meta-Arguments +# ============================================================================ + +resource "cloudflare_zero_trust_device_posture_rule" "with_lifecycle" { + account_id = var.cloudflare_account_id + name = "lifecycle-test-rule" + type = "os_version" + schedule = "24h" + description = "Rule with lifecycle arguments" + + + + lifecycle { + create_before_destroy = true + ignore_changes = [description] + } + input = { + version = "20.4.0" + operator = ">=" + } + match = [{ + platform = "linux" + }] +} + +resource "cloudflare_zero_trust_device_posture_rule" "with_prevent_destroy" { + account_id = var.cloudflare_account_id + name = "prevent-destroy-rule" + type = "firewall" + schedule = "12h" + + + + lifecycle { + prevent_destroy = false # Set to false for testing + } + input = { + enabled = true + } + match = [{ + platform = "windows" + }] +} + +# ============================================================================ +# Pattern Group 9: Edge Cases +# ============================================================================ + +# Minimal resource (only required fields) +resource "cloudflare_zero_trust_device_posture_rule" "minimal" { + account_id = var.cloudflare_account_id + name = "minimal-rule" + type = "firewall" + + + input = { + enabled = true + } + match = [{ + platform = "linux" + }] +} + +# Maximal resource (all fields populated) +resource "cloudflare_zero_trust_device_posture_rule" "maximal" { + account_id = var.cloudflare_account_id + name = "maximal-rule" + type = "os_version" + description = "All fields populated" + schedule = "24h" + expiration = "24h" + + + input = { + version = "22.4.0" + operator = ">=" + os_distro_name = "ubuntu" + os_distro_revision = "22.4.0" + os_version_extra = "(LTS)" + } + match = [{ + platform = "linux" + }] +} + +# Resource with empty/null optional fields +resource "cloudflare_zero_trust_device_posture_rule" "with_nulls" { + account_id = var.cloudflare_account_id + name = "with-nulls" + type = "firewall" + description = null + expiration = null + + + input = { + enabled = true + } + match = [{ + platform = "windows" + }] +} + +# ============================================================================ +# Original Test Cases (Comprehensive Coverage) +# ============================================================================ + # Test case 1: Basic os_version rule with input and match resource "cloudflare_zero_trust_device_posture_rule" "basic" { account_id = var.cloudflare_account_id diff --git a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/terraform.tfstate b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/terraform.tfstate index bc2a683..8a7c470 100644 --- a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/terraform.tfstate +++ b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.15.0", - "serial": 15, + "serial": 16, "lineage": "2e525f2f-6f5f-a864-283c-e2b07953ecb4", "outputs": {}, "resources": [ @@ -368,7 +368,1380 @@ "private": "bnVsbA==" } ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "c09290ea-94b8-4f1c-84f1-277ae9ecf604", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": ">=", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "20.4.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "prod-posture-rule", + "schedule": "24h", + "type": "os_version" + }, + "index_key": "prod" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "a1570f0d-58b3-48bf-9c2b-83395788554b", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "windows" + } + ], + "name": "staging-posture-rule", + "schedule": "12h", + "type": "firewall" + }, + "index_key": "staging" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "9c54bb0b-6725-4dce-80b8-9231c1223269", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": ">=", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "12.0.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "mac" + } + ], + "name": "dev-posture-rule", + "schedule": "6h", + "type": "os_version" + }, + "index_key": "dev" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "6e4db720-298a-4c45-87fa-210cb8f99e71", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "qa-posture-rule", + "schedule": "12h", + "type": "firewall" + }, + "index_key": "qa" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "map_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "c391b7c3-8db9-41fa-a7ce-dc15d7c7779d", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": ">=", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "11.0.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "windows" + } + ], + "name": "perf-posture-rule", + "schedule": "24h", + "type": "os_version" + }, + "index_key": "perf" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "6711e891-6b36-4021-83ac-18feb8dc10b7", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "set-alpha-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "alpha" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "fa546ba6-a9dd-4582-b1ec-2c56e38daabd", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "set-beta-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "beta" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "34b63a00-077e-4cbe-8b46-e00c9e91893f", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "set-gamma-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "gamma" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "set_example", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "eb384a48-2305-47df-900b-473e851e7519", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "set-delta-rule", + "schedule": "5m", + "type": "firewall" + }, + "index_key": "delta" + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "counted", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "This is posture rule number 0", + "expiration": null, + "id": "9b6e9637-95ee-4968-9437-6e22e69eb275", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "==", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "1.0.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "counted-rule-0", + "schedule": "24h", + "type": "os_version" + }, + "index_key": 0 + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "counted", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "This is posture rule number 1", + "expiration": null, + "id": "982829a5-db19-4a42-9118-1585c9e769e0", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "==", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "1.1.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "counted-rule-1", + "schedule": "24h", + "type": "os_version" + }, + "index_key": 1 + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "counted", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "This is posture rule number 2", + "expiration": null, + "id": "23595eb4-40ae-4861-b0b4-31e6b71d41f9", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "==", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "1.2.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "counted-rule-2", + "schedule": "24h", + "type": "os_version" + }, + "index_key": 2 + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "conditional_enabled", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Conditionally enabled firewall rule", + "expiration": null, + "id": "bb367382-5f09-4e36-b66e-e3c617fe1a32", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "windows" + } + ], + "name": "conditional-firewall-enabled", + "schedule": "12h", + "type": "firewall" + }, + "index_key": 0 + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "with_functions", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Rule for account f037e56e89293a057740de681ac9abbe", + "expiration": null, + "id": "e84f7d69-cf1b-4669-923d-209b22919a42", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": ">=", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "22.4.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "test-integration-function-example", + "schedule": "24h", + "type": "os_version" + } + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "with_interpolation", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Interpolated rule name", + "expiration": null, + "id": "c966fc14-5ca2-42ae-924c-35098522249e", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "windows" + } + ], + "name": "rule-for-account-f037e56e89293a057740de681ac9abbe", + "schedule": "5m", + "type": "firewall" + } + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "with_lifecycle", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "Rule with lifecycle arguments", + "expiration": null, + "id": "e558b3ff-588a-41ee-8fd6-46aa704366db", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": ">=", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "20.4.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "lifecycle-test-rule", + "schedule": "24h", + "type": "os_version" + } + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "with_prevent_destroy", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "82abe08a-476e-490e-ab46-ef7300cbb53f", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "windows" + } + ], + "name": "prevent-destroy-rule", + "schedule": "12h", + "type": "firewall" + } + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "minimal", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "32a729fd-1e5c-45d6-be01-0755eb050b9d", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "minimal-rule", + "schedule": null, + "type": "firewall" + } + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "maximal", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": "All fields populated", + "expiration": "24h", + "id": "e17ca2c2-054d-4ad5-a05f-cf950dd462c6", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": false, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": ">=", + "os": "", + "os_distro_name": "ubuntu", + "os_distro_revision": "22.4.0", + "os_version_extra": "(LTS)", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "22.4.0", + "version_operator": "" + } + ], + "match": [ + { + "platform": "linux" + } + ], + "name": "maximal-rule", + "schedule": "24h", + "type": "os_version" + } + } + ] + }, + { + "mode": "managed", + "type": "cloudflare_device_posture_rule", + "name": "with_nulls", + "provider": "provider[\"registry.terraform.io/cloudflare/cloudflare\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": "f037e56e89293a057740de681ac9abbe", + "description": null, + "expiration": null, + "id": "998f1740-c25f-4f5e-896f-696e342be7f7", + "input": [ + { + "active_threats": 0, + "certificate_id": "", + "check_disks": null, + "check_private_key": false, + "cn": "", + "compliance_status": "", + "connection_id": "", + "count_operator": "", + "domain": "", + "eid_last_seen": "", + "enabled": true, + "exists": false, + "extended_key_usage": null, + "id": "", + "infected": false, + "is_active": false, + "issue_count": "", + "last_seen": "", + "locations": [], + "network_status": "", + "operational_state": "", + "operator": "", + "os": "", + "os_distro_name": "", + "os_distro_revision": "", + "os_version_extra": "", + "overall": "", + "path": "", + "require_all": false, + "risk_level": "", + "running": false, + "score": 0, + "sensor_config": "", + "sha256": "", + "state": "", + "thumbprint": "", + "total_score": 0, + "version": "", + "version_operator": "" + } + ], + "match": [ + { + "platform": "windows" + } + ], + "name": "with-nulls", + "schedule": null, + "type": "firewall" + } + } + ] } ], "check_results": null -} +} \ No newline at end of file diff --git a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/zero_trust_device_posture_rule.tf b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/zero_trust_device_posture_rule.tf index f1121f9..484bf20 100644 --- a/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/zero_trust_device_posture_rule.tf +++ b/integration/v4_to_v5/testdata/zero_trust_device_posture_rule/input/zero_trust_device_posture_rule.tf @@ -8,6 +8,318 @@ variable "cloudflare_zone_id" { type = string } +# ============================================================================ +# Pattern Group 1: Variables & Locals +# ============================================================================ + +locals { + common_account = var.cloudflare_account_id + name_prefix = "test-integration" + default_schedule = "24h" + enable_firewall_rules = true + enable_test_rules = false +} + +# ============================================================================ +# Pattern Group 2: for_each with Maps (5 resources) +# ============================================================================ + +resource "cloudflare_device_posture_rule" "map_example" { + for_each = { + "prod" = { + account_id = var.cloudflare_account_id + name = "prod-posture-rule" + type = "os_version" + schedule = "24h" + platform = "linux" + version = "20.4.0" + } + "staging" = { + account_id = var.cloudflare_account_id + name = "staging-posture-rule" + type = "firewall" + schedule = "12h" + platform = "windows" + version = "10.0.0" + } + "dev" = { + account_id = var.cloudflare_account_id + name = "dev-posture-rule" + type = "os_version" + schedule = "6h" + platform = "mac" + version = "12.0.0" + } + "qa" = { + account_id = var.cloudflare_account_id + name = "qa-posture-rule" + type = "firewall" + schedule = "12h" + platform = "linux" + version = "1.0.0" + } + "perf" = { + account_id = var.cloudflare_account_id + name = "perf-posture-rule" + type = "os_version" + schedule = "24h" + platform = "windows" + version = "11.0.0" + } + } + + account_id = each.value.account_id + name = each.value.name + type = each.value.type + schedule = each.value.schedule + + match { + platform = each.value.platform + } + + input { + version = each.value.version + operator = ">=" + } +} + +# ============================================================================ +# Pattern Group 3: for_each with Sets (4 items) +# ============================================================================ + +resource "cloudflare_device_posture_rule" "set_example" { + for_each = toset([ + "alpha", + "beta", + "gamma", + "delta" + ]) + + account_id = var.cloudflare_account_id + name = "set-${each.value}-rule" + type = "firewall" + schedule = "5m" + + match { + platform = "linux" + } + + input { + enabled = true + } +} + +# ============================================================================ +# Pattern Group 4: count-based Resources (3 instances) +# ============================================================================ + +resource "cloudflare_device_posture_rule" "counted" { + count = 3 + + account_id = var.cloudflare_account_id + name = "counted-rule-${count.index}" + type = "os_version" + schedule = "24h" + description = "This is posture rule number ${count.index}" + + match { + platform = "linux" + } + + input { + version = "1.${count.index}.0" + operator = "==" + } +} + +# ============================================================================ +# Pattern Group 5: Conditional Creation +# ============================================================================ + +resource "cloudflare_device_posture_rule" "conditional_enabled" { + count = local.enable_firewall_rules ? 1 : 0 + + account_id = var.cloudflare_account_id + name = "conditional-firewall-enabled" + type = "firewall" + schedule = "12h" + description = "Conditionally enabled firewall rule" + + match { + platform = "windows" + } + + input { + enabled = true + } +} + +resource "cloudflare_device_posture_rule" "conditional_disabled" { + count = local.enable_test_rules ? 1 : 0 + + account_id = var.cloudflare_account_id + name = "conditional-test-disabled" + type = "os_version" + schedule = "6h" + description = "Conditionally disabled test rule" + + match { + platform = "linux" + } + + input { + version = "1.0.0" + operator = ">" + } +} + +# ============================================================================ +# Pattern Group 7: Terraform Functions +# ============================================================================ + +resource "cloudflare_device_posture_rule" "with_functions" { + account_id = local.common_account + + # join() function + name = join("-", [local.name_prefix, "function", "example"]) + + type = "os_version" + schedule = local.default_schedule + description = "Rule for account ${var.cloudflare_account_id}" + + match { + platform = "linux" + } + + input { + version = "22.4.0" + operator = ">=" + } +} + +resource "cloudflare_device_posture_rule" "with_interpolation" { + account_id = var.cloudflare_account_id + name = "rule-for-account-${var.cloudflare_account_id}" + type = "firewall" + schedule = "5m" + description = "Interpolated rule name" + + match { + platform = "windows" + } + + input { + enabled = true + } +} + +# ============================================================================ +# Pattern Group 8: Lifecycle Meta-Arguments +# ============================================================================ + +resource "cloudflare_device_posture_rule" "with_lifecycle" { + account_id = var.cloudflare_account_id + name = "lifecycle-test-rule" + type = "os_version" + schedule = "24h" + description = "Rule with lifecycle arguments" + + match { + platform = "linux" + } + + input { + version = "20.4.0" + operator = ">=" + } + + lifecycle { + create_before_destroy = true + ignore_changes = [description] + } +} + +resource "cloudflare_device_posture_rule" "with_prevent_destroy" { + account_id = var.cloudflare_account_id + name = "prevent-destroy-rule" + type = "firewall" + schedule = "12h" + + match { + platform = "windows" + } + + input { + enabled = true + } + + lifecycle { + prevent_destroy = false # Set to false for testing + } +} + +# ============================================================================ +# Pattern Group 9: Edge Cases +# ============================================================================ + +# Minimal resource (only required fields) +resource "cloudflare_device_posture_rule" "minimal" { + account_id = var.cloudflare_account_id + name = "minimal-rule" + type = "firewall" + + match { + platform = "linux" + } + + input { + enabled = true + } +} + +# Maximal resource (all fields populated) +resource "cloudflare_device_posture_rule" "maximal" { + account_id = var.cloudflare_account_id + name = "maximal-rule" + type = "os_version" + description = "All fields populated" + schedule = "24h" + expiration = "24h" + + match { + platform = "linux" + } + + input { + version = "22.4.0" + operator = ">=" + os_distro_name = "ubuntu" + os_distro_revision = "22.4.0" + os_version_extra = "(LTS)" + } +} + +# Resource with empty/null optional fields +resource "cloudflare_device_posture_rule" "with_nulls" { + account_id = var.cloudflare_account_id + name = "with-nulls" + type = "firewall" + description = null + expiration = null + + match { + platform = "windows" + } + + input { + enabled = true + } +} + +# ============================================================================ +# Original Test Cases (Comprehensive Coverage) +# ============================================================================ + # Test case 1: Basic os_version rule with input and match resource "cloudflare_device_posture_rule" "basic" { account_id = var.cloudflare_account_id