Skip to content

Commit 4841f06

Browse files
kmujumdaJulia3072
authored andcommitted
Added - Support for CloudGuard - Container Workload Integrationn
1 parent 0a125cf commit 4841f06

File tree

95 files changed

+8734
-1149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+8734
-1149
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_id" {}
10+
11+
variable "adhoc_query_access_level" {
12+
default = "ACCESSIBLE"
13+
}
14+
15+
variable "adhoc_query_adhoc_query_details_adhoc_query_resources_region" {
16+
default = "us-phoenix-1"
17+
}
18+
19+
variable "adhoc_query_adhoc_query_details_adhoc_query_resources_resource_ids" {
20+
default = ["ocid1.tenancy.oc1..aaaaaaaaqoggzsjut2u64wqliyd4eyd3dl4ipsu26lgqx4bihofnve5li5hq"]
21+
}
22+
23+
variable "adhoc_query_adhoc_query_details_adhoc_query_resources_resource_type" {
24+
default = "TENANCY"
25+
}
26+
27+
variable "adhoc_query_adhoc_query_details_query" {
28+
default = "select pid from processes"
29+
}
30+
31+
variable "adhoc_query_adhoc_query_status" {
32+
default = "CREATING"
33+
}
34+
35+
variable "adhoc_query_compartment_id_in_subtree" {
36+
default = true
37+
}
38+
39+
variable "adhoc_query_defined_tags_value" {
40+
default = "value"
41+
}
42+
43+
variable "adhoc_query_freeform_tags" {
44+
default = { "bar-key" = "value" }
45+
}
46+
47+
variable "adhoc_query_time_ended_filter_query_param" {
48+
default = "2024-05-03T12:52:59.817Z"
49+
}
50+
51+
variable "adhoc_query_time_started_filter_query_param" {
52+
default = "2024-05-03T10:52:59.817Z"
53+
}
54+
55+
56+
57+
provider "oci" {
58+
auth = "SecurityToken"
59+
config_file_profile = "terraform-federation-test"
60+
region = var.region
61+
//version = "5.39.0"
62+
/*tenancy_ocid = var.tenancy_ocid
63+
user_ocid = var.user_ocid
64+
fingerprint = var.fingerprint
65+
private_key_path = var.private_key_path
66+
region = var.region*/
67+
}
68+
69+
resource "oci_cloud_guard_adhoc_query" "test_adhoc_query" {
70+
#Required
71+
adhoc_query_details {
72+
#Required
73+
adhoc_query_resources {
74+
75+
#Optional
76+
region = var.adhoc_query_adhoc_query_details_adhoc_query_resources_region
77+
resource_ids = var.adhoc_query_adhoc_query_details_adhoc_query_resources_resource_ids
78+
resource_type = var.adhoc_query_adhoc_query_details_adhoc_query_resources_resource_type
79+
}
80+
query = var.adhoc_query_adhoc_query_details_query
81+
}
82+
compartment_id = var.compartment_id
83+
84+
#Optional
85+
defined_tags = { "example-tag-namespace-all.example-tag" = var.adhoc_query_defined_tags_value}
86+
freeform_tags = var.adhoc_query_freeform_tags
87+
}
88+
89+
data "oci_cloud_guard_adhoc_queries" "test_adhoc_queries" {
90+
#Required
91+
compartment_id = var.compartment_id
92+
93+
#Optional
94+
access_level = var.adhoc_query_access_level
95+
adhoc_query_status = var.adhoc_query_adhoc_query_status
96+
compartment_id_in_subtree = var.adhoc_query_compartment_id_in_subtree
97+
time_ended_filter_query_param = var.adhoc_query_time_ended_filter_query_param
98+
time_started_filter_query_param = var.adhoc_query_time_started_filter_query_param
99+
}

examples/cloudguard/data_source/cloud_guard_data_source.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,20 @@ variable "data_source_data_source_details_query_start_time_start_policy_type" {
7979
}
8080

8181
variable "data_source_data_source_details_query_start_time_query_start_time" {
82-
default = "2023-10-18T12:52:59.817Z"
82+
default = "2024-05-02T12:52:59.817Z"
8383
}
8484

8585
provider "oci" {
86+
auth = "SecurityToken"
87+
config_file_profile = "terraform-federation-test"
88+
region = var.region
89+
//version = "5.39.0"
90+
/*
8691
tenancy_ocid = var.tenancy_ocid
8792
user_ocid = var.user_ocid
8893
fingerprint = var.fingerprint
8994
private_key_path = var.private_key_path
90-
region = var.region
95+
*/
9196
}
9297

9398
data "oci_cloud_guard_data_sources" "test_data_sources" {

examples/cloudguard/detector_recipe/cloud_guard_detector_recipe.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,15 @@ variable "detector_recipe_state" {
8080
}
8181

8282
provider "oci" {
83-
tenancy_ocid = "${var.tenancy_ocid}"
83+
auth = "SecurityToken"
84+
config_file_profile = "terraform-federation-test"
85+
region = var.region
86+
//version = "5.39.0"
87+
/*tenancy_ocid = "${var.tenancy_ocid}"
8488
user_ocid = "${var.user_ocid}"
8589
fingerprint = "${var.fingerprint}"
8690
private_key_path = "${var.private_key_path}"
87-
region = "${var.region}"
91+
region = "${var.region}"*/
8892
}
8993

9094
data "oci_cloud_guard_detector_recipes" "test_detector_recipes" {
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_id" {}
10+
11+
variable "saved_query_access_level" {
12+
default = "ACCESSIBLE"
13+
}
14+
15+
variable "saved_query_compartment_id_in_subtree" {
16+
default = true
17+
}
18+
19+
variable "saved_query_defined_tags_value" {
20+
default = "value"
21+
}
22+
23+
variable "saved_query_description" {
24+
default = "description"
25+
}
26+
27+
variable "saved_query_display_name" {
28+
default = "displayName"
29+
}
30+
31+
variable "saved_query_freeform_tags" {
32+
default = { "bar-key" = "value" }
33+
}
34+
35+
variable "saved_query_query" {
36+
default = "select pid from processes"
37+
}
38+
39+
40+
41+
provider "oci" {
42+
auth = "SecurityToken"
43+
config_file_profile = "terraform-federation-test"
44+
region = var.region
45+
//version = "5.39.0"
46+
/*tenancy_ocid = var.tenancy_ocid
47+
user_ocid = var.user_ocid
48+
fingerprint = var.fingerprint
49+
private_key_path = var.private_key_path
50+
region = var.region*/
51+
}
52+
53+
resource "oci_cloud_guard_saved_query" "test_saved_query" {
54+
#Required
55+
compartment_id = var.compartment_id
56+
display_name = var.saved_query_display_name
57+
query = var.saved_query_query
58+
59+
#Optional
60+
defined_tags = { "example-tag-namespace-all.example-tag" = var.saved_query_defined_tags_value}
61+
description = var.saved_query_description
62+
freeform_tags = var.saved_query_freeform_tags
63+
}
64+
65+
data "oci_cloud_guard_saved_queries" "test_saved_queries" {
66+
#Required
67+
compartment_id = var.compartment_id
68+
69+
#Optional
70+
access_level = var.saved_query_access_level
71+
compartment_id_in_subtree = var.saved_query_compartment_id_in_subtree
72+
display_name = var.saved_query_display_name
73+
}

examples/cloudguard/target/cloud_guard_target.tf

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Licensed under the Mozilla Public License v2.0
33

44
variable "tenancy_ocid" {}
5-
variable "user_ocid" {}
6-
variable "fingerprint" {}
7-
variable "private_key_path" {}
5+
//variable "user_ocid" {}
6+
//variable "fingerprint" {}
7+
//variable "private_key_path" {}
88
variable "region" {}
99
variable "compartment_id" {}
1010

@@ -81,11 +81,16 @@ variable "target_target_responder_recipes_responder_rules_details_mode" {
8181
}
8282

8383
provider "oci" {
84+
auth = "SecurityToken"
85+
config_file_profile = "terraform-federation-test"
86+
region = var.region
87+
//version = "5.39.0"
88+
/*
8489
tenancy_ocid = "${var.tenancy_ocid}"
8590
user_ocid = "${var.user_ocid}"
8691
fingerprint = "${var.fingerprint}"
8792
private_key_path = "${var.private_key_path}"
88-
region = "${var.region}"
93+
*/
8994
}
9095

9196
/*
@@ -94,7 +99,7 @@ For more explanation refer to detector_recipe.tf or responder_recipe.tf
9499
*/
95100
data "oci_cloud_guard_detector_recipes" "test_detector_recipes" {
96101
#Required
97-
compartment_id = "${var.tenancy_ocid}"
102+
compartment_id = var.tenancy_ocid
98103
#Optional
99104
state = "ACTIVE"
100105
//Adding this to make sure the detector rule id is compatible with the returned detector recipes
@@ -103,7 +108,7 @@ data "oci_cloud_guard_detector_recipes" "test_detector_recipes" {
103108

104109
data "oci_cloud_guard_responder_recipes" "test_responder_recipes" {
105110
#Required
106-
compartment_id = "${var.tenancy_ocid}"
111+
compartment_id = var.tenancy_ocid
107112
#Optional
108113
state = "ACTIVE"
109114
}
@@ -112,19 +117,19 @@ data "oci_cloud_guard_responder_recipes" "test_responder_recipes" {
112117

113118
resource "oci_cloud_guard_target" "test_target" {
114119
#Required
115-
compartment_id = "${var.compartment_id}"
116-
display_name = "${var.target_display_name}"
120+
compartment_id = var.compartment_id
121+
display_name = var.target_display_name
117122
//For now target resource id has to be equal to comaprtment id
118-
target_resource_id = "${var.compartment_id}"
119-
target_resource_type = "${var.target_target_resource_type}"
123+
target_resource_id = var.compartment_id
124+
target_resource_type = var.target_target_resource_type
120125

121126
#Optional
122-
description = "${var.target_description}"
123-
state = "${var.target_state}"
127+
description = var.target_description
128+
state = var.target_state
124129

125130
target_detector_recipes {
126131
#Required
127-
detector_recipe_id = "${data.oci_cloud_guard_detector_recipes.test_detector_recipes.detector_recipe_collection.0.items.0.id}"
132+
detector_recipe_id = data.oci_cloud_guard_detector_recipes.test_detector_recipes.detector_recipe_collection.0.items.0.id
128133

129134
#Optional
130135
detector_rules {
@@ -133,8 +138,8 @@ resource "oci_cloud_guard_target" "test_target" {
133138
#Optional
134139
condition_groups {
135140
#Required
136-
compartment_id = "${var.compartment_id}"
137-
condition = "${var.target_target_detector_recipes_detector_rules_details_condition_groups_condition}"
141+
compartment_id = var.compartment_id
142+
condition = var.target_target_detector_recipes_detector_rules_details_condition_groups_condition
138143
}
139144
}
140145

@@ -144,23 +149,23 @@ resource "oci_cloud_guard_target" "test_target" {
144149

145150
target_responder_recipes {
146151
#Required
147-
responder_recipe_id = "${data.oci_cloud_guard_responder_recipes.test_responder_recipes.responder_recipe_collection.0.items.0.id}"
152+
responder_recipe_id = data.oci_cloud_guard_responder_recipes.test_responder_recipes.responder_recipe_collection.0.items.0.id
148153

149154
#Optional
150155
responder_rules {
151156
#Required
152157
details {
153158
#Optional
154-
condition = "${var.target_target_responder_recipes_responder_rules_details_condition}"
159+
condition = var.target_target_responder_recipes_responder_rules_details_condition
155160

156161
configurations {
157162
#Required
158-
config_key = "${var.target_target_responder_recipes_responder_rules_details_configurations_config_key}"
159-
name = "${var.target_target_responder_recipes_responder_rules_details_configurations_name}"
160-
value = "${var.target_target_responder_recipes_responder_rules_details_configurations_value}"
163+
config_key = var.target_target_responder_recipes_responder_rules_details_configurations_config_key
164+
name = var.target_target_responder_recipes_responder_rules_details_configurations_name
165+
value = var.target_target_responder_recipes_responder_rules_details_configurations_value
161166
}
162167

163-
mode = "${var.target_target_responder_recipes_responder_rules_details_mode}"
168+
mode = var.target_target_responder_recipes_responder_rules_details_mode
164169
}
165170

166171
responder_rule_id = "ENABLE_DB_BACKUP"
@@ -170,11 +175,11 @@ resource "oci_cloud_guard_target" "test_target" {
170175

171176
data "oci_cloud_guard_targets" "test_targets" {
172177
#Required
173-
compartment_id = "${var.compartment_id}"
178+
compartment_id = var.compartment_id
174179

175180
#Optional
176-
access_level = "${var.target_access_level}"
177-
compartment_id_in_subtree = "${var.target_compartment_id_in_subtree}"
178-
display_name = "${var.target_display_name}"
179-
state = "${var.target_state}"
181+
access_level = var.target_access_level
182+
compartment_id_in_subtree = var.target_compartment_id_in_subtree
183+
display_name = var.target_display_name
184+
state = var.target_state
180185
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_id" {}
10+
11+
variable "wlp_agent_agent_version" {
12+
default = "1.0.147"
13+
}
14+
15+
variable "wlp_agent_certificate_signed_request" {
16+
default = "-----BEGIN CERTIFICATE REQUEST-----\nMIID1DCCArwCAQAwggGNMQswCQYDVQQGEwJVUzEPMA0GA1UEChMGT3JhY2xlMYIB\nKDCCASQGA1UECxOCARtvcGMtaW5zdGFuY2U6b2NpZDEuaW5zdGFuY2Uub2MxLnBo\neC5hbnlocWxqdDd4bTQ1Y2ljeWkya2E1cHVtcWd5dWhkZXVhaHJjYXh6NHN3bGtv\nZmo2dXhjdmtubnhkaGEsb3BjLWNvbXBhcnRtZW50Om9jaWQxLnRlbmFuY3kub2Mx\nLi5hYWFhYWFhYXFvZ2d6c2p1dDJ1NjR3cWxpeWQ0ZXlkM2RsNGlwc3UyNmxncXg0\nYmlob2ZudmU1bGk1aHEsb3BjLXRlbmFudDpvY2lkMS50ZW5hbmN5Lm9jMS4uYWFh\nYWFhYWFxb2dnenNqdXQydTY0d3FsaXlkNGV5ZDNkbDRpcHN1MjZsZ3F4NGJpaG9m\nbnZlNWxpNWhxMQwwCgYDVQQDEwN3bHAxMzAxBgkqhkiG9w0BCQEWJHdvcmtsb2Fk\ncHJvdGVjdGlvbl91c19ncnBAb3JhY2xlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD\nggEPADCCAQoCggEBAMDLbqoECIIh02HvkusRyGGI/cqK9Wrg7xDn/Wwg1C9noOo+\nbHmU5sBervLUHKXuC3IUwM0GgytjLsOjMWI9ex0ZunQONwwAe/MDD+YQcnqbOnmb\naUrdp0gB231SRqCUST1xf9y8shlK3zXrav+qgtF1bDihsGh6O4DMLPYIsOZAXo6M\nrGPokj1nViLdvFaBBG4Q1sgximufh/eqFCaUawIUOeQ7XcDqeWM+G8IA3vIuWqbr\nSoI61/COgq6eDsUMu/ZcMNF0UYRV4bWwVM18Cx8Tlp0kH/mbnlHxBMxz1x/cbHmQ\nEwPrSKWo8Gn2B1HeXWhVGNPa4Xs0xn/kaW1QaS8CAwEAAaAAMA0GCSqGSIb3DQEB\nCwUAA4IBAQABiABQPOngTCA24KzY6GcyVi/4H6nhOu6smAgnPM2PoJEoog5yvnLR\nTvoyec0TTIIiRZtDIYejRMUyGZxR1o1Hgrkq80OmqfRZW57e2WPRgpHcp87Yfp0B\nRmkobQMRSAypZDGCdco2cuQ4F7GG0KFMb1Tf+b/XQnf6L3cd9PCHPECOVe1LFJV3\nqxhNkkxd+REI8iihLjzslqJFufYTkfmL2xamhS2nzGbG5XcfURdqx6S2ZDVoCkNy\nikohM9PlBrWAXWYALRqgcy1KFH9lQ9+tIqpnGbOHOyIqFPmoMKX2ugisTWMpgTp9\nxICh2HMz77KABXXf/t58HDODI4Wx8yJA\n-----END CERTIFICATE REQUEST-----\n"
17+
}
18+
19+
variable "wlp_agent_os_info" {
20+
default = "Oracle Linux Server_8.5_amd64"
21+
}
22+
23+
24+
25+
provider "oci" {
26+
auth = "SecurityToken"
27+
config_file_profile = "terraform-federation-test"
28+
region = var.region
29+
//version = "5.39.0"
30+
/*tenancy_ocid = var.tenancy_ocid
31+
user_ocid = var.user_ocid
32+
fingerprint = var.fingerprint
33+
private_key_path = var.private_key_path
34+
region = var.region*/
35+
}
36+
37+
resource "oci_cloud_guard_wlp_agent" "test_wlp_agent" {
38+
#Required
39+
agent_version = var.wlp_agent_agent_version
40+
certificate_signed_request = var.wlp_agent_certificate_signed_request
41+
compartment_id = var.compartment_id
42+
os_info = var.wlp_agent_os_info
43+
}
44+
45+
data "oci_cloud_guard_wlp_agents" "test_wlp_agents" {
46+
#Required
47+
compartment_id = var.compartment_id
48+
}

0 commit comments

Comments
 (0)