diff --git a/terraform/main.tf b/terraform/main.tf index 16f99af5..e6c1efff 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,4 +1,4 @@ -# Copyright (c) 2023, Oracle and/or its affiliates. +# Copyright (c) 2023,2024, Oracle and/or its affiliates. # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. ### Removing network validation script from provisioning flow temporarily. @@ -609,6 +609,7 @@ module "compute" { wls_domain_name = format("%s_domain", local.service_name_prefix) wls_server_startup_args = var.wls_server_startup_args wls_existing_vcn_id = var.wls_existing_vcn_id + create_policies = var.create_policies #The following two are for adding a dependency on the peering module wls_vcn_peering_dns_resolver_id = element(flatten(concat(module.vcn-peering[*].wls_vcn_dns_resolver_id, [""])), 0) diff --git a/terraform/modules/compute/wls_compute/variables.tf b/terraform/modules/compute/wls_compute/variables.tf index 5d6c74f3..de2b0bed 100644 --- a/terraform/modules/compute/wls_compute/variables.tf +++ b/terraform/modules/compute/wls_compute/variables.tf @@ -1,4 +1,4 @@ -# Copyright (c) 2023, Oracle and/or its affiliates. +# Copyright (c) 2023,2024, Oracle and/or its affiliates. # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. variable "tenancy_id" { @@ -16,6 +16,11 @@ variable "compartment_id" { description = "The OCID of the compartment where the compute will be created" } +variable "create_policies" { + type = bool + description = "Set to true to create OCI IAM policies and dynamic groups required by the WebLogic for OCI stack. If this is set to false, the policies and dynamic groups need to be created manually" +} + variable "availability_domain" { type = string description = "The label of the availability domain where the compute will be created" diff --git a/terraform/modules/compute/wls_compute/wls_compute.tf b/terraform/modules/compute/wls_compute/wls_compute.tf index 12f4f228..19b3029d 100644 --- a/terraform/modules/compute/wls_compute/wls_compute.tf +++ b/terraform/modules/compute/wls_compute/wls_compute.tf @@ -1,4 +1,4 @@ -# Copyright (c) 2023, Oracle and/or its affiliates. +# Copyright (c) 2023, 2024, Oracle and/or its affiliates. # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. module "compute-keygen" { @@ -9,7 +9,7 @@ module "wls-instances" { source = "../instance" - instance_params = { for x in range(var.num_vm_instances) : "${local.host_label}-${x}" => { + instance_params = { for x in range(var.num_vm_instances) : "${local.host_label}-${format("%02d", x)}" => { availability_domain = var.use_regional_subnet ? local.ad_names[(x + local.admin_ad_index) % length(local.ad_names)] : var.availability_domain @@ -67,6 +67,7 @@ module "wls-instances" { wls_subnet_cidr = local.wls_subnet_cidr wls_edition = var.wls_edition is_bastion_instance_required = var.is_bastion_instance_required + create_policies = var.create_policies user_data = data.template_cloudinit_config.config.rendered mode = var.mode diff --git a/terraform/modules/compute/wls_compute/wls_volume.tf b/terraform/modules/compute/wls_compute/wls_volume.tf index 1557d8c0..dc70c5f1 100644 --- a/terraform/modules/compute/wls_compute/wls_volume.tf +++ b/terraform/modules/compute/wls_compute/wls_volume.tf @@ -1,9 +1,9 @@ -# Copyright (c) 2023, Oracle and/or its affiliates. +# Copyright (c) 2023, 2024, Oracle and/or its affiliates. # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. module "middleware-volume" { source = "../volume" - bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-mw-block-${x}" => { + bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-mw-block-${format("%02d", x)}" => { ad = var.use_regional_subnet ? local.ad_names[(x + local.admin_ad_index) % length(local.ad_names)] : var.availability_domain compartment_id = var.compartment_id display_name = "${var.resource_name_prefix}-mw-block-${x}" @@ -18,7 +18,7 @@ module "middleware-volume" { module "data-volume" { source = "../volume" - bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-data-block-${x}" => { + bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-data-block-${format("%02d", x)}" => { ad = var.use_regional_subnet ? local.ad_names[(x + local.admin_ad_index) % length(local.ad_names)] : var.availability_domain compartment_id = var.compartment_id display_name = "${var.resource_name_prefix}-data-block-${x}" @@ -35,7 +35,7 @@ module "middleware_volume_attach" { bv_params = { empty = { ad = "", compartment_id = "", display_name = "", bv_size = 0, defined_tags = { def = "" }, freeform_tags = { free = "" } } } - bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${x}" => { + bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${format("%02d", x)}" => { display_name = "${var.resource_name_prefix}-block-volume-attach-${x}" attachment_type = "iscsi" instance_id = module.wls-instances.instance_ids[x / var.num_volumes] @@ -49,7 +49,7 @@ module "data_volume_attach" { bv_params = { empty = { ad = "", compartment_id = "", display_name = "", bv_size = 0, defined_tags = { def = "" }, freeform_tags = { free = "" } } } - bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${x}" => { + bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${format("%02d", x)}" => { display_name = "${var.resource_name_prefix}-block-volume-attach-${x}" attachment_type = "iscsi" instance_id = module.wls-instances.instance_ids[x / var.num_volumes] diff --git a/terraform/variables.tf b/terraform/variables.tf index ca25b621..d501760f 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -1,4 +1,4 @@ -# Copyright (c) 2023, Oracle and/or its affiliates. +# Copyright (c) 2023,2024, Oracle and/or its affiliates. # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. variable "tenancy_ocid" {