Skip to content

Commit 77a2f3a

Browse files
Merge pull request #1588 from oracle/release_gh
Releasing version 4.75.0
2 parents 95157a5 + 75102d2 commit 77a2f3a

File tree

195 files changed

+10260
-615
lines changed

Some content is hidden

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

195 files changed

+10260
-615
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 4.75.0 (May 11, 2022)
2+
3+
### Added
4+
- Support for securityzones
5+
- Updating state of closed ADG Standby to not show as Available
6+
- Support for Resource Usage Tracking
7+
### Bug Fix
8+
- Fixed the test cases for APIGateway Client mTLS feature
9+
110
## 4.74.0 (May 04, 2022)
211

312
### Added

examples/cloudguard/cloudguard_advancedMode_example/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ variable "detector_recipe_detector_rules_details_configurations_config_key" {
156156
default = "lbCertificateExpiringSoonConfig"
157157
}
158158
variable "detector_recipe_detector_rules_details_configurations_data_type" {
159-
default = "multiList"
159+
default = "int"
160160
}
161161
variable "detector_recipe_detector_rules_details_configurations_name" {
162-
default = "Days before expiring - Checkpoint 1"
162+
default = "Days before expiring"
163163
}
164164
variable "detector_recipe_detector_rules_details_configurations_value" {
165165
default = "30"

examples/cloudguard/cloudguard_basic_example/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ variable "detector_recipe_detector_rules_details_configurations_config_key" {
126126
default = "lbCertificateExpiringSoonConfig"
127127
}
128128
variable "detector_recipe_detector_rules_details_configurations_data_type" {
129-
default = "multiList"
129+
default = "int"
130130
}
131131
variable "detector_recipe_detector_rules_details_configurations_name" {
132-
default = "Days before expiring - Checkpoint 1"
132+
default = "Days before expiring"
133133
}
134134
variable "detector_recipe_detector_rules_details_configurations_value" {
135135
default = "30"
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
/* The below .tf script must be run only once per realm. Cloud Guard is a realm-level service and once a region is selected as the reporting region,
2+
* all other existing and newly subscribed regions in the realm are automatically considered as monitoring regions.
3+
* The reporting region must be same as tenant's home region.
4+
* Replace <your_boat_group> in the IAM policy below with your BOAT group.
5+
*/
6+
7+
//Common variables required
8+
variable "tenancy_ocid" {}
9+
variable "user_ocid" {}
10+
variable "fingerprint" {}
11+
variable "private_key_path" {}
12+
variable "region" {}
13+
variable "compartment_ocid" {}
14+
15+
provider "oci" {
16+
tenancy_ocid = var.tenancy_ocid
17+
user_ocid = var.user_ocid
18+
fingerprint = var.fingerprint
19+
private_key_path = var.private_key_path
20+
region = var.region
21+
}
22+
23+
//****** Capability Check to verify Cloudguard is available in the given realm ******
24+
data "capability" "cloudguard_available" {
25+
name = "cloudguard_available"
26+
}
27+
28+
locals {
29+
cloud_guard_available = data.capability.cloudguard_available.is_available
30+
//Only enable Cloud Guard in reporting region as Cloud Guard is a realm-level service
31+
cloud_guard_enable = var.cloud_guard_configuration_reporting_region == var.region
32+
}
33+
34+
//****** Add Cloud Guard IAM Policies ******
35+
36+
resource "oci_identity_policy" "cloud_guard_policy" {
37+
count = data.capability.cloudguard_available.is_available ? 1 : 0
38+
compartment_id = var.tenancy_ocid
39+
description = "This policy allows cloud guard service to detect security vulnerabilities in tenancy"
40+
name = "CloudGuardPolicies"
41+
statements = [
42+
"allow group <your_boat_group> to read threat-intel-family in tenancy",
43+
"allow service cloudguard to read keys in tenancy",
44+
"allow service cloudguard to read compartments in tenancy",
45+
"allow service cloudguard to read compute-management-family in tenancy",
46+
"allow service cloudguard to read instance-family in tenancy",
47+
"allow service cloudguard to read virtual-network-family in tenancy",
48+
"allow service cloudguard to read volume-family in tenancy",
49+
"allow service cloudguard to read tenancies in tenancy",
50+
"allow service cloudguard to read audit-events in tenancy",
51+
"allow service cloudguard to read vaults in tenancy",
52+
"allow service cloudguard to read object-family in tenancy",
53+
"allow service cloudguard to read load-balancers in tenancy",
54+
"allow service cloudguard to read groups in tenancy",
55+
"allow service cloudguard to read dynamic-groups in tenancy",
56+
"allow service cloudguard to read users in tenancy",
57+
"allow service cloudguard to read database-family in tenancy",
58+
"allow service cloudguard to read authentication-policies in tenancy",
59+
"allow service cloudguard to read policies in tenancy",
60+
"allow service cloudguard to use network-security-groups in tenancy",
61+
"allow service cloudguard to read data-safe-family in tenancy",
62+
"allow service cloudguard to read autonomous-database-family in tenancy",
63+
"allow service cloudguard to manage cloudevents-rules in tenancy where target.rule.type='managed'"
64+
]
65+
}
66+
67+
//****** Enable Cloud Guard ******
68+
69+
//The reporting region needs to be a valid reporting region where the tenancy is subscribed to.
70+
//In most cases the home-region of the tenancy is its reporting region.
71+
//In a single region tenancy, the home region, reporting region and the monitoring region are all same.
72+
variable "cloud_guard_configuration_reporting_region" {
73+
default = "us-ashburn-1"
74+
}
75+
76+
//The acceptable values for status are `ENABLED` and `DISABLED`.
77+
//DISABLING the tenancy is equivalent to off-boarding resulting in deletion of all the Control Plane entities, also disallowing most of the CloudGuard Operations.
78+
//Once ENABLED, the reporting region can't be switched unless it is DISABLED and then ENABLED again for another region.
79+
//However, The reporting region needs to be a valid reporting region where the tenancy is subscribed to.
80+
variable "cloud_guard_configuration_status" {
81+
default = "ENABLED"
82+
}
83+
84+
// Refer to the cloudguard_advancedMode_example to see its usage
85+
variable "cloud_guard_configuration_self_manage_resources" {
86+
default = false
87+
}
88+
89+
//Cloud Guard enabling and disabling is a tenant-level operation so the compartment-id needs to be a tenant-ocid.
90+
resource "oci_cloud_guard_cloud_guard_configuration" "enable_cloud_guard" {
91+
count = local.cloud_guard_available && local.cloud_guard_enable ? 1 : 0
92+
compartment_id = var.tenancy_ocid
93+
reporting_region = var.cloud_guard_configuration_reporting_region
94+
status = var.cloud_guard_configuration_status
95+
depends_on = [oci_identity_policy.cloud_guard_policy]
96+
}
97+
98+
//****** List Cloud Guard Responder Recipes ******
99+
100+
variable "responder_recipe_state" {
101+
default = "ACTIVE"
102+
}
103+
104+
data "oci_cloud_guard_responder_recipes" "compartment_responder_recipes" {
105+
compartment_id = var.tenancy_ocid
106+
state = var.responder_recipe_state
107+
depends_on = [oci_cloud_guard_cloud_guard_configuration.enable_cloud_guard]
108+
}
109+
110+
//****** List Cloud Guard Detector Recipes ******
111+
112+
variable "detector_recipe_state" {
113+
default = "ACTIVE"
114+
}
115+
116+
data "oci_cloud_guard_detector_recipes" "compartment_detector_recipes" {
117+
compartment_id = var.tenancy_ocid
118+
state = var.detector_recipe_state
119+
depends_on = [oci_cloud_guard_cloud_guard_configuration.enable_cloud_guard]
120+
}
121+
122+
//****** Create a Cloud Guard Target with all the default recipes attached ******
123+
/* PS: refer to cloudguard_advancedMode_example and cloudguard_basic_example on
124+
* how to further tweaks input settings for creation of customer control plane resources
125+
* eg: targets, recipes, managedLists etc.
126+
*/
127+
128+
variable "target_display_name" {
129+
default = "root"
130+
}
131+
variable "target_state" {
132+
default = "ACTIVE"
133+
}
134+
variable "target_resource_type" {
135+
default = "COMPARTMENT"
136+
}
137+
138+
resource "oci_cloud_guard_target" "root_target" {
139+
compartment_id = var.compartment_ocid
140+
display_name = var.target_display_name
141+
target_resource_id = var.compartment_ocid
142+
target_resource_type = var.target_resource_type
143+
state = var.target_state
144+
145+
dynamic "target_detector_recipes" {
146+
for_each = length(data.oci_cloud_guard_detector_recipes.compartment_detector_recipes.detector_recipe_collection) > 0 ?
147+
data.oci_cloud_guard_detector_recipes.compartment_detector_recipes.detector_recipe_collection[0].items : []
148+
iterator = detector_recipe
149+
content {
150+
detector_recipe_id = detector_recipe.value["id"]
151+
}
152+
}
153+
154+
dynamic "target_responder_recipes" {
155+
for_each = length(data.oci_cloud_guard_responder_recipes.compartment_responder_recipes.responder_recipe_collection) > 0 ?
156+
data.oci_cloud_guard_responder_recipes.compartment_responder_recipes.responder_recipe_collection[0].items : []
157+
iterator = responder_recipe
158+
content {
159+
responder_recipe_id = responder_recipe.value["id"]
160+
}
161+
}
162+
163+
depends_on = [oci_cloud_guard_cloud_guard_configuration.enable_cloud_guard]
164+
}

examples/cloudguard/detector_recipe/cloud_guard_detector_recipe.tf

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,17 @@ variable "detector_recipe_detector_rules_details_configurations_config_key" {
3939
}
4040

4141
variable "detector_recipe_detector_rules_details_configurations_data_type" {
42-
default = "multiList"
42+
default = "int"
4343
}
4444

4545
variable "detector_recipe_detector_rules_details_configurations_name" {
46-
default = "Days before expiring - Setting 1"
46+
default = "Days before expiring"
4747
}
4848

4949
variable "detector_recipe_detector_rules_details_configurations_value" {
5050
default = "30"
5151
}
5252

53-
//Acceptable values come from ConfigurationListItemTypeEnum
54-
variable "detector_recipe_detector_rules_details_configurations_values_list_type" {
55-
default = "CUSTOM"
56-
}
57-
58-
//Has some specific acceptable managed list types values, picking one for testing purposes
59-
variable "detector_recipe_detector_rules_details_configurations_values_managed_list_type" {
60-
default = "RESOURCE_OCID"
61-
}
62-
63-
variable "detector_recipe_detector_rules_details_configurations_values_value" {
64-
default = "ocid.detectectorrecipe.test1"
65-
}
66-
6753
variable "detector_recipe_detector_rules_details_is_enabled" {
6854
default = true
6955
}
@@ -106,7 +92,9 @@ data "oci_cloud_guard_detector_recipes" "test_detector_recipes" {
10692
compartment_id = "${var.tenancy_ocid}"
10793

10894
#Optional
109-
state = "${var.detector_recipe_state}"
95+
state = "${var.detector_recipe_state}"
96+
# Adding this to make sure the detector_rule_id we use later on is valid against the returned recipes
97+
display_name = "OCI Configuration Detector Recipe"
11098
}
11199

112100
resource "oci_cloud_guard_detector_recipe" "test_detector_recipe" {
@@ -148,18 +136,11 @@ resource "oci_cloud_guard_detector_recipe" "test_detector_recipe" {
148136
#Optional
149137
data_type = "${var.detector_recipe_detector_rules_details_configurations_data_type}"
150138
value = "${var.detector_recipe_detector_rules_details_configurations_value}"
151-
152-
values {
153-
#Required
154-
list_type = "${var.detector_recipe_detector_rules_details_configurations_values_list_type}"
155-
managed_list_type = "${var.detector_recipe_detector_rules_details_configurations_values_managed_list_type}"
156-
value = "${var.detector_recipe_detector_rules_details_configurations_values_value}"
157-
}
158139
}
159140

160141
labels = "${var.detector_recipe_detector_rules_details_labels}"
161142
}
162-
143+
// Make sure the detector rule id is valid for the detector recipe being cloned.
163144
detector_rule_id = "LB_CERTIFICATE_EXPIRING_SOON"
164145
}
165146

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright (c) 2017, 2021, 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 "security_zone_access_level" {
12+
default = "ACCESSIBLE"
13+
}
14+
15+
variable "security_zone_description" {
16+
default = "description"
17+
}
18+
19+
//Has to be unique
20+
variable "security_zone_display_name" {
21+
default = "displayName"
22+
}
23+
24+
//Acceptable values come from LifecycleStateEnum
25+
variable "lifecycle_state_active" {
26+
default = "ACTIVE"
27+
}
28+
29+
provider "oci" {
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+
38+
data "oci_cloud_guard_security_recipes" "test_security_recipes" {
39+
#Required
40+
compartment_id = "${var.tenancy_ocid}"
41+
#Optional
42+
state = "${var.lifecycle_state_active}"
43+
}
44+
45+
data "oci_cloud_guard_security_zones" "test_security_zones" {
46+
#Required
47+
compartment_id = "${var.compartment_id}"
48+
#Optional
49+
state = "${var.lifecycle_state_active}"
50+
}
51+
52+
/*
53+
This data sources is used to get the security_policy_id to attach to security zone.
54+
*/
55+
data "oci_cloud_guard_security_policies" "test_security_policies" {
56+
#Required
57+
compartment_id = "${var.tenancy_ocid}"
58+
#Optional
59+
state = "${var.lifecycle_state_active}"
60+
}
61+
62+
/*
63+
When CloudGuard is enabled, a Maximum Security Zone Recipe with all the default policies enabled is
64+
made available. If a user wants to create a custom Security Zone Recipe,
65+
then they can perform a create recipe with all the relevant policies enabled.
66+
67+
In this example, we will list all the available security recipes and then pick the first item in
68+
the collection for creating a security zone.
69+
*/
70+
resource "oci_cloud_guard_security_zone" "test_security_zone" {
71+
#Required
72+
compartment_id = "${var.compartment_id}"
73+
display_name = "${var.security_zone_display_name}"
74+
security_zone_recipe_id = "${data.oci_cloud_guard_security_recipes.test_security_recipes.security_recipe_collection.0.items.0.id}"
75+
76+
77+
#Optional
78+
description = "${var.security_zone_description}"
79+
}

0 commit comments

Comments
 (0)