Sample Scripts
Following are a few sample scripts in Oracle WebLogic Server for OCI.
Following is a sample script for file:
terraform.tfvars
:tenancy_ocid = "<Tenancy OCID>"
user_id = "<User OCID>"
fingerprint = "<Fingerprint>"
private_key_path = "<path-to-oci_api_key.pem>"
compartment_ocid = "<Stack Compartment OCID>"
region = "<Region>"
// Stack config
service_name = "<Stack Service Prefix>"
wls_edition = "EE"
wls_version = "12.2.1.4"
// WLS Instance config
instance_shape = "<WebLogic Instance Shape-example-VM.Standard.E3.Flex>"
instance_image_id = "<WebLogic Image OCID>"
wls_admin_password_ocid = "<WebLogic Admin Passowrd Secret OCID>"
wls_node_count = 2
ssh_public_key = "<SSH Public Key text>"
// Network config - Existing VCN, Create New Subnet
network_compartment_id = "<Network Compartment OCID>"
wls_existing_vcn_id = "<VCN OCID>"
wls_subnet_cidr = "10.0.1.0/24"
bastion_subnet_cidr = "10.0.2.0/24"
bastion_instance_shape = "<Bastion Instance Shape-example-VM.Standard.E3.Flex>"
add_load_balancer = true
lb_subnet_1_cidr = "10.0.3.0/24"
lb_max_bandwidth = "100"
Following is a sample script for file:
env-var.sh
:# Use this template to create a file env_vars and source it before running terraform.
### Region
export TF_VAR_region="us-phoenix-1"
### Public/private keys used on the instance
export TF_VAR_ssh_public_key=$(cat ~/xperiment_rsa.pub)
export TF_VAR_ssh_private_key=$(cat ~/xperiment_rsa)
## NOTE: These are not your api keys. More info on the right keys see
## https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/managingkeypairs.htm
## https://docs.cloud.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm
Following is a sample script for file:
oci_db.tfvars
. Use this file to provision WLSC with OCI
database, along with
instance.tfvars
.#DB VCN ID
ocidb_existing_vcn_id = "<VCN OCID>"
#DB Compartment
ocidb_compartment_id = "<Compartment OCID>"
#DB Network Compartment
#ocidb_network_compartment_id ="<Network Compartment OCID>"
#DB System
ocidb_dbsystem_id ="<OCID>"
#Database
ocidb_database_id = "<OCID>"
#PDB Name
ocidb_pdb_service_name = "PDB"
#Provide DB user creds.
oci_db_user = "sys"
oci_db_password_ocid = "<OCID>"
#VCN peering param for OCI DB
ocidb_dns_subnet_cidr = "10.0.7.0/11"
Following is a sample script for file:
atp_db.tfvars
. Use this file to provision WLSC with ATP
database, along with
instance.tfvars
.atp_db_level = "low"
atp_db_id = "<OCID>"
atp_db_password="<password>"
atp_db_compartment_id="<OCID>"
Following is a sample script for file:
instance_idcs.tfvars
. This is a sample template for
provisioning 2 node WLSC, an existing VCN, an existing public subnet, loadbalancer, and
IDCS.// Region for provisioning
region = "<region>"
// WLS config
service_name = "WLSCIDCS"
// WLS instance shape
instance_shape = "VM.Standard2.2"
// WLS instances count
wls_node_count = "2"
// Add LB
add_load_balancer = true
lb_use_https = false
// Add IDCS
is_idcs_selected = true
idcs_host = "<host>"
idcs_port = "443"
idcs_tenant = "<tenant>"
idcs_client_id = "<ID>"
idcs_client_secret_ocid = "<OCID>"
idcs_cloudgate_port = "9999"
// WLS admin creds
wls_admin_user = "weblogic"
wls_admin_password_ocid = "<OCID>"
// WLS custom image ID
instance_image_id = "<OCID>"
// WLS and VCN compartment ID
compartment_ocid = "<OCID>"
network_compartment_id = "<OCID>"
// WLS existing VCN
wls_existing_vcn_id = "<OCID>"
// WLS existing VCN
wls_subnet_id = "<OCID>"
// LB existing Subnet
lb_subnet_1_id = "<OCID>"
#lb_subnet_2_id = "" -- not used for regional subnet - uncomment for non-regional.
wls_edition = "EE"
wls_version = "12.2.1.4"
//"12.2.1.4", 14.1.1.0
// Creating policies
create_policies = true
// Private Subnet Config
assign_weblogic_public_ip = true
// Regional subnet config
use_regional_subnet = true
wls_console_port="7001"
Following is a sample script with all variables:
instance.tfvars
:// Region for provisioning
region = "<region>"
// WLS config
service_name = "abc"
// WLS Edition
wls_edition = "EE"
# SE, EE, SUITE
// WLS Version
wls_version = "12.2.1.4"
# 12.2.1.4, 14.1.1.0
// WLS instance shape
instance_shape = "VM.Standard2.2"
// WLS instances count
wls_node_count = "1"
// Database port
db_port = "1521"
// Add LB
add_load_balancer = false
lb_use_https = false
is_lb_private= false
// Add IDCS
is_idcs_selected = true
idcs_host = "<host>"
idcs_port = "443"
idcs_tenant = "<tenant>"
idcs_client_id = "<ID>"
idcs_client_secret_ocid = "<OCID>"
idcs_cloudgate_port = "9999"
// WLS admin Credentials
wls_admin_user = "<User>"
wls_admin_password_ocid = "<password OCID>"
// WLS custom image ID
instance_image_id = "<OCID>"
// WLS and VCN compartment ID
compartment_ocid = "<OCID>"
network_compartment_id = "<OCID>"
// Existing_vcn
wls_existing_vcn_id="<OCID>"
// Exisiting_subnet
wls_subnet_id="<OCID>"
// Existing LB Subnet
lb_subnet_id="<OCID>"
// Existing Bastion Subnet
bastion_subnet_id="<OCID>"
// This is for New VCN
wls_vcn_name="wls_vcn"
// WLS subnet CIDR, LB Backend and Frontend Subnet CIDRs for new subnets that will be created.
wls_subnet_cidr = "20.0.0.0/10"
lb_subnet_1_cidr = "10.0.94.0/11"
lb_subnet_2_cidr ="10.0.95.0/11"
// not used for regional subnet - uncomment for non-regional.
// Bastion host subnet CIDR.
// Required for existing VCN and if not using existing bastion subnet (see bastion_subnet_id)
// And if assign_weblogic_public_ip = false (using private subnet).
bastion_subnet_cidr="10.0.86.0/11"
// VCN Peering Parameters
ocidb_dns_subnet_cidr = "10.0.7.0/11"
wls_dns_subnet_cidr = "13.0.7.0/11"
// Private Subnet Config
assign_weblogic_public_ip = true
// Regional subnet config
use_regional_subnet = true
// WLS Console Port
wls_console_port="7001"
Following is a sample structure to create free-form tags and defined tags
for the
service_tag
field. Use this sample structure in the variables
if you want to assign tags to the
resources.# create freeformTags
service_tag={"freeformTags"={"free_tag1"="free_tag1_value","free_tag2"="free_tag2_value"},"definedTags"={}}
# create definedTags
service_tag={"freeformTags"= {}, "definedTags"={"wls-tag-namespace.wls-oci-tag1"="test1","wls-tag-namespace.wls-oci-tag2"="test2"}}
#Note: Ensure that the namespace, wls-tag-namespace used in the example is already created.
# create both freeformTags and definedTags
service_tag={"freeformTags"={"free_tag1"="free_tag1_value","free_tag2"="free_tag2_value"} ,"definedTags"={"wls-tag-namespace.wls-oci-tag1"="test1","wls-tag-namespace.wls-oci-tag2"="test2"}}