Skip to content

Commit 3bee1d8

Browse files
committed
Merge branch 'bastion' into 'development'
Resolve some naming conflicts and recover tenancy ocid See merge request pse-lz-dev/eslz!18
2 parents 44d5628 + 1f3cd18 commit 3bee1d8

File tree

7 files changed

+35
-9
lines changed

7 files changed

+35
-9
lines changed

budget/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# -----------------------------------------------------------------------------
22
# Required inputs
33
# -----------------------------------------------------------------------------
4+
variable "tenancy_ocid" {
5+
type = string
6+
description = "the ocid of tenancy"
7+
}
8+
49
variable "budget_amount" {
510
description = "The amount of the budget expressed as a whole number in the currency of the customer's rate card."
611
default = null

compartments.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ locals {
1212
# Create Parent compartment, for top level organization
1313
# -----------------------------------------------------------------------------
1414
module "parent-compartment" {
15-
source = "./compartments/parent-compartment"
15+
source = "./compartments/parent_compartment"
1616
compartment_delete_enabled = var.is_sandbox_mode_enabled
1717
tenancy_ocid = var.tenancy_ocid
1818
compartment_name = var.parent_compartment_name
@@ -29,7 +29,7 @@ module "parent-compartment" {
2929
# Create compartment for common infrastructure compartments
3030
# -----------------------------------------------------------------------------
3131
module "common-infra-compartment" {
32-
source = "./compartments/common-infra-compartment"
32+
source = "./compartments/common_infra_compartment"
3333
compartment_delete_enabled = var.is_sandbox_mode_enabled
3434
parent_compartment_ocid = module.parent-compartment.parent_compartment_id
3535
compartment_name = var.common_infra_compartment_name
@@ -46,7 +46,7 @@ module "common-infra-compartment" {
4646
# Create compartment for application compartments
4747
# -----------------------------------------------------------------------------
4848
module "applications-compartment" {
49-
source = "./compartments/applications-compartment"
49+
source = "./compartments/applications_compartment"
5050
compartment_delete_enabled = var.is_sandbox_mode_enabled
5151
parent_compartment_ocid = module.parent-compartment.parent_compartment_id
5252
compartment_name = var.applications_compartment_name
@@ -63,7 +63,7 @@ module "applications-compartment" {
6363
# Create compartment for network components
6464
# -----------------------------------------------------------------------------
6565
module "network-compartment" {
66-
source = "./compartments/network-compartment"
66+
source = "./compartments/network_compartment"
6767
compartment_delete_enabled = var.is_sandbox_mode_enabled
6868
common_infra_compartment_ocid = module.common-infra-compartment.common_infra_compartment_id
6969
compartment_name = var.network_compartment_name
@@ -80,7 +80,7 @@ module "network-compartment" {
8080
# Create compartment for security components
8181
# -----------------------------------------------------------------------------
8282
module "security-compartment" {
83-
source = "./compartments/security-compartment"
83+
source = "./compartments/security_compartment"
8484
compartment_delete_enabled = var.is_sandbox_mode_enabled
8585
common_infra_compartment_ocid = module.common-infra-compartment.common_infra_compartment_id
8686
compartment_name = var.security_compartment_name

compartments/parent_compartment/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# -----------------------------------------------------------------------------
22
# Required inputs
33
# -----------------------------------------------------------------------------
4+
variable "tenancy_ocid" {
5+
type = string
6+
description = "root-level / tenancy OCID"
7+
}
8+
49
variable "compartment_name" {
510
type = string
611
description = "Name of the compartment to create"

iam/policies/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,14 @@ resource "oci_identity_policy" "security_admins_policy_network" {
172172
]
173173
}
174174

175+
resource "random_id" "security" {
176+
byte_length = 4
177+
}
178+
175179
resource "oci_identity_policy" "security_admins_policy_root" {
176180
compartment_id = var.tenancy_ocid
177181
description = "OCI Landing Zone Security Admin Root Policy"
178-
name = "${var.security_admins_policy_name}-Root"
182+
name = "${var.security_admins_policy_name}-Root-${random_id.security.hex}"
179183

180184
freeform_tags = {
181185
"Description" = "Root Policy for Security Admin Users",

security/audit/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ resource "time_offset" "bucket_creation_timestamp" {
3434
offset_days = 15
3535
}
3636

37+
resource "random_id" "bucket" {
38+
byte_length = 4
39+
}
40+
3741
resource "oci_objectstorage_bucket" "audit_log_bucket" {
3842
compartment_id = var.security_compartment_ocid
3943
namespace = data.oci_objectstorage_namespace.ns.namespace
40-
name = "${var.audit_log_bucket_name}${var.suffix}"
44+
name = "${var.audit_log_bucket_name}${var.suffix}${random_id.bucket.hex}"
4145
access_type = "NoPublicAccess"
4246
kms_key_id = var.key_id
4347
storage_tier = "Archive"

security/cloud-guard/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ resource "oci_cloud_guard_cloud_guard_configuration" "tenancy_cloud_guard_config
1717
# ---------------------------------------------------------------------------------------------------------------------
1818
# Cloud Guard policies
1919
# ---------------------------------------------------------------------------------------------------------------------
20+
resource "random_id" "cloudguard" {
21+
byte_length = 4
22+
}
23+
2024
resource "oci_identity_policy" "cloud_guard_policy" {
2125
provider = oci.home_region
2226
compartment_id = var.tenancy_ocid
2327
description = "OCI Landing Zone Cloud Guard Policy"
24-
name = "${var.cloud_guard_policy_name}${var.suffix}"
28+
name = "${var.cloud_guard_policy_name}${var.suffix}${random_id.cloudguard.hex}"
2529

2630
freeform_tags = {
2731
"Description" = "Cloud guard policy"

security/flow-logs/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ resource "oci_logging_log_group" "central_log_group" {
2121
}
2222
}
2323

24+
resource "random_id" "log" {
25+
byte_length = 4
26+
}
27+
2428
resource "oci_log_analytics_log_analytics_log_group" "log_analytics_log_group" {
2529
count = var.using_third_party_siem ? 0 : 1
2630
compartment_id = var.security_compartment_ocid
27-
display_name = "${var.log_analytics_log_group_display_name}${var.suffix}"
31+
display_name = "${var.log_analytics_log_group_display_name}${var.suffix}${random_id.log.hex}"
2832
namespace = data.oci_log_analytics_namespaces.logging_analytics_namespaces.namespace_collection[0].items[0].namespace
2933

3034
freeform_tags = {

0 commit comments

Comments
 (0)