Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Copyright (c) 2023, 2026, 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.
/*
module "network-validation" {
source = "./modules/network-validator"
count = local.use_existing_subnets && !var.skip_network_validation ? 1 : 0
Expand All @@ -24,11 +22,12 @@ module "network-validation" {
existing_mount_target_nsg_id = var.add_existing_nsg && var.add_fss ? var.existing_mount_target_nsg_id : ""
existing_bastion_nsg_id = var.add_existing_nsg && var.is_bastion_instance_required ? var.existing_bastion_nsg_id : ""
lb_source_cidr = var.add_load_balancer ? (var.is_lb_private ? "" : "0.0.0.0/0") : ""
secure_mode = var.configure_secure_mode
idcs_cloudgate_port = var.idcs_cloudgate_port
}
*/

module "system-tags" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/resource-tags"
compartment_id = var.compartment_ocid
service_name = var.service_name
Expand Down Expand Up @@ -212,7 +211,7 @@ module "network-bastion-subnet" {
}

module "policies" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/policies"
count = var.create_policies ? 1 : 0
compartment_id = var.compartment_ocid
Expand Down Expand Up @@ -256,7 +255,7 @@ module "policies" {
}

module "bastion" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/compute/bastion"
count = (!local.assign_weblogic_public_ip && local.is_bastion_instance_required && var.existing_bastion_instance_id == "") ? 1 : 0
availability_domain = local.bastion_availability_domain
Expand Down Expand Up @@ -344,7 +343,7 @@ module "network-mount-target-private-subnet" {
}

module "vcn-peering" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
count = local.is_vcn_peering ? 1 : 0
source = "./modules/network/vcn-peering"
resource_name_prefix = local.service_name_prefix
Expand All @@ -362,7 +361,6 @@ module "vcn-peering" {
}

module "validators" {
#depends_on = [module.network-validation]
source = "./modules/validators"
compartment_id = var.compartment_ocid
service_name = var.service_name
Expand Down Expand Up @@ -492,7 +490,7 @@ module "validators" {
}

module "fss" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/fss"
count = var.add_fss ? 1 : 0

Expand All @@ -515,7 +513,7 @@ module "fss" {
}

module "load-balancer" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/lb/loadbalancer"
count = (local.add_load_balancer && var.existing_load_balancer_id == "") ? 1 : 0

Expand All @@ -536,6 +534,7 @@ module "load-balancer" {
}

module "rms-private-endpoint" {
depends_on = [module.network-validation]
source = "./modules/rms-private-endpoint"
count = local.is_rms_private_endpoint_required && local.add_new_rms_private_endpoint ? 1 : 0

Expand All @@ -552,7 +551,7 @@ module "rms-private-endpoint" {
}

module "observability-common" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/observability/common"
count = var.use_oci_logging ? 1 : 0

Expand All @@ -562,7 +561,7 @@ module "observability-common" {
}

module "observability-autoscaling" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/observability/autoscaling"
count = var.use_autoscaling ? 1 : 0

Expand Down Expand Up @@ -595,6 +594,7 @@ module "observability-autoscaling" {
}

module "observability-osmh"{
depends_on = [module.network-validation]
source = "./modules/observability/osmh"
count = local.create_profile ? 1 : 0
tenancy_id = var.tenancy_ocid
Expand All @@ -603,6 +603,7 @@ module "observability-osmh"{
}

module "compute" {
depends_on = [module.network-validation]
source = "./modules/compute/wls_compute"
add_loadbalancer = local.add_load_balancer
is_lb_private = var.is_lb_private
Expand All @@ -619,7 +620,8 @@ module "compute" {
wls_subnet_id = var.wls_subnet_id
region = var.region
ssh_public_key = var.ssh_public_key
compute_nsg_ids = local.compute_nsg_ids
compute_nsg_ids = local.compute_nsg_ids
num_ads = local.num_ads
tenancy_id = var.tenancy_ocid
tf_script_version = var.tf_script_version
use_regional_subnet = local.use_regional_subnet
Expand Down Expand Up @@ -750,7 +752,7 @@ module "compute" {
}

module "load-balancer-backends" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/lb/backends"
count = local.add_load_balancer ? 1 : 0

Expand All @@ -768,7 +770,7 @@ module "load-balancer-backends" {
}

module "observability-logging" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/observability/logging"
count = var.use_oci_logging ? 1 : 0

Expand All @@ -786,7 +788,7 @@ module "observability-logging" {
}

module "provisioners" {
#depends_on = [module.network-validation]
depends_on = [module.network-validation]
source = "./modules/provisioners"

existing_bastion_instance_id = var.existing_bastion_instance_id
Expand Down
21 changes: 5 additions & 16 deletions terraform/modules/compute/wls_compute/data_sources.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

data "oci_identity_fault_domains" "wls_fault_domains" {
Expand All @@ -7,7 +7,7 @@ data "oci_identity_fault_domains" "wls_fault_domains" {
}

data "template_file" "ad_names" {
count = length(data.oci_identity_availability_domains.ADs.availability_domains)
count = var.num_ads
template = (length(regexall("^.*Flex", var.instance_shape.instanceShape)) > 0 || length(regexall("^BM.*", var.instance_shape.instanceShape)) > 0 || (tonumber(lookup(data.oci_limits_limit_values.compute_shape_service_limits[count.index].limit_values[0], "value")) > 0)) ? lookup(data.oci_identity_availability_domains.ADs.availability_domains[count.index], "name") : ""
}

Expand All @@ -16,7 +16,7 @@ data "oci_identity_availability_domains" "ADs" {
}

data "oci_limits_limit_values" "compute_shape_service_limits" {
count = length(data.oci_identity_availability_domains.ADs.availability_domains)
count = var.num_ads
compartment_id = var.tenancy_id
service_name = "compute"

Expand All @@ -35,24 +35,13 @@ data "template_file" "key_script" {
}
}

data "oci_core_shapes" "oci_shapes" {
count = length(data.oci_identity_availability_domains.ADs.availability_domains)
compartment_id = var.compartment_id
image_id = var.instance_image_id
availability_domain = lookup(data.oci_identity_availability_domains.ADs.availability_domains[count.index], "name")
filter {
name = "name"
values = [var.instance_shape.instanceShape]
}
}

data "oci_database_autonomous_database" "atp_db" {
count = local.is_atp_db ? 1 : 0
autonomous_database_id = var.jrf_parameters.atp_db_parameters.atp_db_id
}

data "template_file" "atp_nsg_id" {
count = local.is_atp_db && !local.is_db_deleted ? 1 : 0
count = local.is_atp_db ? 1 : 0
template = length(data.oci_database_autonomous_database.atp_db[0].nsg_ids) > 0 ? data.oci_database_autonomous_database.atp_db[0].nsg_ids[0] : ""
}

Expand All @@ -76,6 +65,6 @@ data "oci_database_database" "ocidb_database" {
}

data "oci_database_db_home" "ocidb_db_home" {
count = local.is_ocidb_system_id_available && !local.is_db_deleted ? 1 : 0
count = local.is_ocidb_system_id_available ? 1 : 0
db_home_id = data.oci_database_database.ocidb_database[0].db_home_id
}
7 changes: 6 additions & 1 deletion terraform/modules/compute/wls_compute/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, 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" {
Expand Down Expand Up @@ -353,3 +353,8 @@ variable "certificate_id" {
default = ""
}

variable "num_ads" {
type = number
description = "Number of availability domains per region in the tenancy"
}

4 changes: 3 additions & 1 deletion terraform/modules/network-validator/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

locals {
Expand All @@ -20,4 +20,6 @@ locals {
validation_script_existing_lb_nsg_id_param = var.existing_lb_nsg_id != "" ? format("--lbnsg %s", var.existing_lb_nsg_id) : ""
validation_script_existing_mount_target_nsg_id_param = var.existing_mount_target_nsg_id != "" ? format("--fssnsg %s", var.existing_mount_target_nsg_id) : ""
validation_script_existing_bastion_nsg_id_param = var.existing_bastion_nsg_id != "" ? format("--bastionnsg %s", var.existing_bastion_nsg_id) : ""
validation_script_secure_mode_param = var.secure_mode != "" ? format("--securemode %s", var.secure_mode) : ""
validation_script_idcs_cloudgate_port_param = var.idcs_cloudgate_port != "" ? format("--idcs_port %s", var.idcs_cloudgate_port) : ""
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright (c) 2023, 2025, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
#
# ############################################################################
Expand Down Expand Up @@ -1346,7 +1346,7 @@ then
fi

if [[ $res -ne 0 ]]; then
echo "ERROR: Egress rule - DB port ${DB_PORT} is not open for access by DB Subnet CIDR [${db_subnet_cidr_block}] in WLS Subnet [${WLS_SUBNET_OCID}] or in WLS NSG [${MANAGED_SRV_NSG_OCID}]."
echo "ERROR: Egress rule - DB port ${ATP_DB_PORT} is not open for access by DB Subnet CIDR [${db_subnet_cidr_block}] in WLS Subnet [${WLS_SUBNET_OCID}] or in WLS NSG [${MANAGED_SRV_NSG_OCID}]."
validation_return_code=2
fi
fi
Expand Down Expand Up @@ -1451,7 +1451,7 @@ then
done
elif [[ $res -ne 0 ]]
then
echo "ERROR: Port ${ADMIN_HTTPS_PORT} is not open for access by [$bastion_cidr_block] in WLS Subnet [$WLS_SUBNET_OCID]. ${NETWORK_VALIDATION_MSG}"
echo "ERROR: Port ${ADMIN_HTTPS_PORT} is not open for access by bastion subnet cidr [$bastion_cidr_block] in WLS Subnet [$WLS_SUBNET_OCID]. ${NETWORK_VALIDATION_MSG}"
validation_return_code=2
fi
fi
Expand All @@ -1466,7 +1466,7 @@ then
done
elif [[ $res -ne 0 ]]
then
echo "ERROR: Port ${ADMIN_HTTPS_PORT} is not open for access by [$bastion_cidr_block] in Admin Server NSG [$ADMIN_SRV_NSG_OCID]. ${NETWORK_VALIDATION_MSG}"
echo "ERROR: Port ${ADMIN_HTTPS_PORT} is not open for access by bastion subnet cidr [$bastion_cidr_block] in Admin Server NSG [$ADMIN_SRV_NSG_OCID]. ${NETWORK_VALIDATION_MSG}"
validation_return_code=2
fi
fi
Expand Down
4 changes: 2 additions & 2 deletions terraform/modules/network-validator/validator.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

resource "null_resource" "validate_network" {
provisioner "local-exec" {
command = "chmod +x ./scripts/network_validation.sh && ./scripts/network_validation.sh ${local.validation_script_wls_subnet_param} ${local.validation_script_bastion_subnet_param} ${local.validation_script_bastion_ip_param} ${local.validation_script_lb_subnet_1_param} ${local.validation_script_lb_subnet_2_param} ${local.validation_script_wls_lb_port} ${local.validation_script_lb_source_cidr_param} ${local.validation_script_mount_target_subnet_param} ${local.validation_script_atp_db_id_param} ${local.validation_script_oci_db_dbsystem_id_param} ${local.validation_script_oci_db_port_param} ${local.validation_script_http_port_param} ${local.validation_script_https_port_param} ${local.validation_script_existing_admin_server_nsg_id_param} ${local.validation_script_existing_managed_server_nsg_id_param} ${local.validation_script_existing_lb_nsg_id_param} ${local.validation_script_existing_mount_target_nsg_id_param} ${local.validation_script_existing_bastion_nsg_id_param}"
command = "chmod +x ./scripts/network_validation.sh && ./scripts/network_validation.sh ${local.validation_script_wls_subnet_param} ${local.validation_script_bastion_subnet_param} ${local.validation_script_bastion_ip_param} ${local.validation_script_lb_subnet_1_param} ${local.validation_script_lb_subnet_2_param} ${local.validation_script_wls_lb_port} ${local.validation_script_lb_source_cidr_param} ${local.validation_script_mount_target_subnet_param} ${local.validation_script_atp_db_id_param} ${local.validation_script_oci_db_dbsystem_id_param} ${local.validation_script_oci_db_port_param} ${local.validation_script_http_port_param} ${local.validation_script_https_port_param} ${local.validation_script_existing_admin_server_nsg_id_param} ${local.validation_script_existing_managed_server_nsg_id_param} ${local.validation_script_existing_lb_nsg_id_param} ${local.validation_script_existing_mount_target_nsg_id_param} ${local.validation_script_existing_bastion_nsg_id_param} ${local.validation_script_secure_mode_param} ${local.validation_script_idcs_cloudgate_port_param}"
interpreter = ["/bin/bash", "-c"]
working_dir = path.module
}
Expand Down
12 changes: 11 additions & 1 deletion terraform/modules/network-validator/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "wls_subnet_id" {
Expand Down Expand Up @@ -90,3 +90,13 @@ variable "lb_source_cidr" {
type = string
description = "Set to empty value if loadbalancer is set to private"
}

variable "secure_mode" {
type = bool
description = "Indicates whether the secure mode is enabled or not"
}

variable "idcs_cloudgate_port" {
type = number
description = "The listen port for the Identity Cloud Service App Gateway, which authenticates requests and redirects them to WebLogic Server"
}
4 changes: 2 additions & 2 deletions terraform/modules/observability/osmh/create_profile.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "oci_os_management_hub_software_source_change_availability_management" "software_source_change_availability_management" {
for_each = toset(local.filtered_sources)
for_each = toset(local.software_source_names)

software_source_availabilities {
software_source_id = each.value
software_source_id = local.software_source_id_by_name[each.key]
availability_at_oci = var.software_availabilty
}
}
Expand Down
14 changes: 12 additions & 2 deletions terraform/modules/observability/osmh/locals.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

locals {
all_tenancy_osmh_software_sources = data.oci_os_management_hub_software_sources.all_tenancy_osmh_software_sources.software_source_collection[0].items
software_source_names = [
Expand All @@ -11,8 +14,15 @@ locals {
"ol8_mysql80_community-x86_64"
]

software_source_id_by_name = {
for src in local.all_tenancy_osmh_software_sources :
src.display_name => src.id
}

filtered_sources = [
for src in local.all_tenancy_osmh_software_sources : src.id
if contains(local.software_source_names, src.display_name)
for name in local.software_source_names :
local.software_source_id_by_name[name]
if contains(keys(local.software_source_id_by_name), name)
]
}

6 changes: 2 additions & 4 deletions terraform/network_variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

# Variable used in UI only
Expand Down Expand Up @@ -265,10 +265,8 @@ variable "wait_time_wls_vnc_dns_resolver" {
default = 60
}

/*
variable "skip_network_validation" {
type = bool
description = "Used in case there is something really wrong with the validation and we need to skip it"
description = "Allows skipping the network validation when the validation cannot be completed successfully."
default = false
}
*/
17 changes: 17 additions & 0 deletions terraform/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ groupings:
- ${subnet_type}
- ${subnet_span}
- ${add_existing_nsg}
- ${skip_network_validation}

- title: "WebLogic Domain Configuration"
variables:
Expand Down Expand Up @@ -997,6 +998,22 @@ variables:
dependsOn:
compartmentId: ${wls_admin_secret_compartment_id}

#Network Validation script execution
skip_network_validation:
visible:
and:
- not:
- ${orm_create_mode}
- not:
- ${create_new_vcn}
- not:
- ${create_new_subnets}
type: boolean
default: false
title: "Skip Validation of Existing Network"
description: "Skip running the network validation script for the selected existing VCN. See <a target=\"_blank\" href=\"https://docs.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/weblogic-cloud/user&id=oci_network_validate\">Validate Existing Network Setup</a>"


# WLS Network Configuration
wls_vcn_name:
visible:
Expand Down
Loading