Merge pull request #3 from MichaHoffmann/add_heredoc_templates
WIP add heredoc templates; only EOF marker at the moment
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
root = true
|
||||
|
||||
[*.{c,txt,js}]
|
||||
[*.{cc,txt,js}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
tab_width = 8
|
||||
|
||||
0
.gitattributes
vendored
0
.gitattributes
vendored
17
.github/workflows/acceptance.yaml
vendored
Normal file
17
.github/workflows/acceptance.yaml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: acceptance
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
unittests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: nixbuild/nix-quick-install-action@v5
|
||||
- run: nix-shell --run 'tree-sitter test'
|
||||
acceptance:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: nixbuild/nix-quick-install-action@v5
|
||||
- run: nix-shell --run 'tree-sitter parse --quiet --stat example/real_world_stuff/*/*'
|
||||
11
.github/workflows/unittests.yaml
vendored
11
.github/workflows/unittests.yaml
vendored
@@ -1,11 +0,0 @@
|
||||
name: unittests
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
unittests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: nixbuild/nix-quick-install-action@v5
|
||||
- run: nix-shell --run 'tree-sitter test'
|
||||
16
README.md
16
README.md
@@ -6,7 +6,7 @@ tree-sitter grammar for the [HCL](https://github.com/hashicorp/hcl/blob/main/hcl
|
||||
|
||||
Highlighting `example/example.hcl`:
|
||||
|
||||

|
||||

|
||||
|
||||
## Developing
|
||||
|
||||
@@ -18,15 +18,16 @@ To run tests simply run `nix-shell --run 'tree-sitter test'`.
|
||||
|
||||
## Compliance
|
||||
|
||||
The directory `example/real_world_stuff` contains a corpus of hcl files that I found with the github query `language:HCL` for users `coreos` and `hashicorp`
|
||||
The directory `example/real_world_stuff` contains a corpus of hcl files that I found with the github query `language:HCL` for users `coreos`, `hashicorp`, `oracle` and `terraform-community-modules`.
|
||||
|
||||
Given that some language features are still missing ( see TODO ) there are some expected parse errors:
|
||||
|
||||
```bash
|
||||
nix-shell --run 'tree-sitter parse --quiet --stat example/real_world_stuff/*/*'
|
||||
...
|
||||
...
|
||||
Total parses: 1130; successful parses: 1053; failed parses: 77; success percentage: 93.19%
|
||||
tree-sitter parse --quiet --stat example/real_world_stuff/*/*
|
||||
|
||||
example/real_world_stuff/oracle/oracle%opengrok%opengrok-indexer%src%test%resources%analysis%terraform%sample.tf 1 ms (ERROR [205, 8] - [214, 1])
|
||||
|
||||
Total parses: 2015; successful parses: 2014; failed parses: 1; success percentage: 99.95%
|
||||
|
||||
```
|
||||
|
||||
@@ -40,4 +41,5 @@ The aim is to build unit testcases from selected failure classes and slowly get
|
||||
* [x] add quoted templates
|
||||
* [x] add quoted template interpolations
|
||||
* [ ] add quoted template directives
|
||||
* [ ] add heredoc templates
|
||||
* [x] add heredoc templates
|
||||
|
||||
|
||||
@@ -28,6 +28,11 @@ resource_1 "strlit1" "strlit2" {
|
||||
tpl1 = "prefix-${var.bar}"
|
||||
tpl2 = "prefix-${func("bar")}"
|
||||
tpl3 = "prefix-${func("nested-${var.bar}")}"
|
||||
tpl4 = <<EOF
|
||||
prefix
|
||||
${func("foo${ var.bar }")}
|
||||
suffix
|
||||
EOF
|
||||
|
||||
nested_resource_1 {
|
||||
attr1 = 2
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# Availability Domain
|
||||
data "oci_identity_availability_domains" "ADs" {
|
||||
compartment_id = "${var.oracle_tenancy_ocid}"
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.director_ad}"]
|
||||
}
|
||||
}
|
||||
|
||||
data "oci_identity_compartments" "Compartments" {
|
||||
compartment_id = "${var.oracle_tenancy_ocid}"
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.director_compartment_name}"]
|
||||
}
|
||||
}
|
||||
|
||||
data "oci_core_virtual_networks" "VCNs" {
|
||||
compartment_id = "${data.null_data_source.SetupConfig.inputs.compartment_id}"
|
||||
filter {
|
||||
name = "display_name"
|
||||
values = ["${var.director_vcn}"]
|
||||
}
|
||||
}
|
||||
|
||||
data "null_data_source" "SetupConfig" {
|
||||
inputs = {
|
||||
ad_name = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[0],"name")}"
|
||||
compartment_id = "${lookup(data.oci_identity_compartments.Compartments.compartments[0],"id")}"
|
||||
}
|
||||
}
|
||||
|
||||
data "null_data_source" "VCN" {
|
||||
inputs = {
|
||||
id = "${lookup(data.oci_core_virtual_networks.VCNs.virtual_networks[0], "id")}"
|
||||
dhcp_options_id = "${lookup(data.oci_core_virtual_networks.VCNs.virtual_networks[0], "default_dhcp_options_id")}"
|
||||
default_route_table_id = "${lookup(data.oci_core_virtual_networks.VCNs.virtual_networks[0], "default_route_table_id")}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
resource "oci_core_virtual_network" "VCN" {
|
||||
cidr_block = "${var.vcn_cidr}"
|
||||
compartment_id = "${data.null_data_source.SetupConfig.outputs["compartment_id"]}"
|
||||
display_name = "${var.director_vcn}"
|
||||
}
|
||||
*/
|
||||
|
||||
resource "oci_core_security_list" "ci_public_all" {
|
||||
compartment_id = "${data.null_data_source.SetupConfig.inputs.compartment_id}"
|
||||
display_name = "ci_public_all"
|
||||
vcn_id = "${data.null_data_source.VCN.inputs.id}"
|
||||
egress_security_rules = [{
|
||||
protocol = "all"
|
||||
destination = "0.0.0.0/0"
|
||||
}]
|
||||
ingress_security_rules = [{
|
||||
protocol = "all"
|
||||
source = "0.0.0.0/0"
|
||||
}]
|
||||
}
|
||||
|
||||
resource "oci_core_subnet" "director_subnet" {
|
||||
availability_domain = "${data.null_data_source.SetupConfig.inputs.ad_name}"
|
||||
cidr_block = "${var.director_subnet_cidr}"
|
||||
display_name = "ci_director_subnet_${replace(data.null_data_source.SetupConfig.inputs.ad_name, "-", "_")}"
|
||||
dhcp_options_id = "${data.null_data_source.VCN.inputs.dhcp_options_id}"
|
||||
compartment_id = "${data.null_data_source.SetupConfig.inputs.compartment_id}"
|
||||
vcn_id = "${data.null_data_source.VCN.inputs.id}"
|
||||
route_table_id = "${data.null_data_source.VCN.inputs.default_route_table_id}"
|
||||
security_list_ids = ["${oci_core_security_list.ci_public_all.id}"]
|
||||
prohibit_public_ip_on_vnic = false
|
||||
}
|
||||
|
||||
resource "oci_core_subnet" "bats_subnet1" {
|
||||
availability_domain = "${data.null_data_source.SetupConfig.inputs.ad_name}"
|
||||
cidr_block = "${var.bats_subnet1_cidr}"
|
||||
display_name = "ci_bats_subnet1_${replace(data.null_data_source.SetupConfig.inputs.ad_name, "-", "_")}"
|
||||
dhcp_options_id = "${data.null_data_source.VCN.inputs.dhcp_options_id}"
|
||||
compartment_id = "${data.null_data_source.SetupConfig.inputs.compartment_id}"
|
||||
vcn_id = "${data.null_data_source.VCN.inputs.id}"
|
||||
route_table_id = "${data.null_data_source.VCN.inputs.default_route_table_id}"
|
||||
security_list_ids = ["${oci_core_security_list.ci_public_all.id}"]
|
||||
prohibit_public_ip_on_vnic = false
|
||||
}
|
||||
|
||||
resource "oci_core_subnet" "bats_subnet2" {
|
||||
availability_domain = "${data.null_data_source.SetupConfig.inputs.ad_name}"
|
||||
cidr_block = "${var.bats_subnet2_cidr}"
|
||||
display_name = "ci_bats_subnet2_${replace(data.null_data_source.SetupConfig.inputs.ad_name, "-", "_")}"
|
||||
dhcp_options_id = "${data.null_data_source.VCN.inputs.dhcp_options_id}"
|
||||
compartment_id = "${data.null_data_source.SetupConfig.inputs.compartment_id}"
|
||||
vcn_id = "${data.null_data_source.VCN.inputs.id}"
|
||||
route_table_id = "${data.null_data_source.VCN.inputs.default_route_table_id}"
|
||||
security_list_ids = ["${oci_core_security_list.ci_public_all.id}"]
|
||||
prohibit_public_ip_on_vnic = false
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
output vcn {
|
||||
value = "${var.director_vcn}"
|
||||
}
|
||||
output subnet_id {
|
||||
value = "${oci_core_subnet.director_subnet.id}"
|
||||
|
||||
}
|
||||
output compartment_id {
|
||||
value = "${oci_core_subnet.director_subnet.compartment_id}"
|
||||
}
|
||||
|
||||
output ad {
|
||||
value = "${oci_core_subnet.director_subnet.availability_domain}"
|
||||
}
|
||||
|
||||
output subnet_name {
|
||||
value = "${oci_core_subnet.director_subnet.display_name}"
|
||||
}
|
||||
output subnet_cidr {
|
||||
value = "${oci_core_subnet.director_subnet.cidr_block}"
|
||||
}
|
||||
|
||||
output subnet_gw {
|
||||
value = "${cidrhost(oci_core_subnet.director_subnet.cidr_block, 1)}"
|
||||
}
|
||||
|
||||
output subnet_first_ip {
|
||||
value = "${cidrhost(oci_core_subnet.director_subnet.cidr_block, 2)}"
|
||||
}
|
||||
|
||||
output bats_subnet1_name {
|
||||
value = "${oci_core_subnet.bats_subnet1.display_name}"
|
||||
}
|
||||
|
||||
output bats_subnet1_cidr {
|
||||
value = "${oci_core_subnet.bats_subnet1.cidr_block}"
|
||||
}
|
||||
|
||||
output bats_subnet1_gw {
|
||||
value ="${cidrhost(oci_core_subnet.bats_subnet1.cidr_block, 1)}"
|
||||
}
|
||||
|
||||
output bats_subnet1_reserved {
|
||||
value = "${cidrhost(oci_core_subnet.bats_subnet1.cidr_block, 2)} - ${cidrhost(oci_core_subnet.bats_subnet1.cidr_block, 9)}"
|
||||
}
|
||||
|
||||
output bats_subnet1_static {
|
||||
value = "${cidrhost(oci_core_subnet.bats_subnet1.cidr_block, 10)} - ${cidrhost(oci_core_subnet.bats_subnet1.cidr_block, 30)}"
|
||||
}
|
||||
|
||||
output bats_subnet1_static_ip {
|
||||
value = "${cidrhost(oci_core_subnet.bats_subnet1.cidr_block, 30)}"
|
||||
}
|
||||
|
||||
output bats_subnet2_name {
|
||||
value = "${oci_core_subnet.bats_subnet2.display_name}"
|
||||
}
|
||||
|
||||
output bats_subnet2_cidr {
|
||||
value = "${oci_core_subnet.bats_subnet2.cidr_block}"
|
||||
}
|
||||
|
||||
output bats_subnet2_gw {
|
||||
value ="${cidrhost(oci_core_subnet.bats_subnet2.cidr_block, 1)}"
|
||||
}
|
||||
|
||||
output bats_subnet2_reserved {
|
||||
value = "${cidrhost(oci_core_subnet.bats_subnet2.cidr_block, 2)} - ${cidrhost(oci_core_subnet.bats_subnet2.cidr_block, 9)}"
|
||||
}
|
||||
|
||||
output bats_subnet2_static {
|
||||
value = "${cidrhost(oci_core_subnet.bats_subnet2.cidr_block, 10)} - ${cidrhost(oci_core_subnet.bats_subnet2.cidr_block, 30)}"
|
||||
}
|
||||
|
||||
output bats_subnet2_static_ip {
|
||||
value = "${cidrhost(oci_core_subnet.bats_subnet2.cidr_block, 30)}"
|
||||
}
|
||||
|
||||
/*
|
||||
output director_subnet {
|
||||
value = <<EOS
|
||||
{
|
||||
"subnet_id" : "${oci_core_subnet.director_subnet.id}",
|
||||
"compartment_id" : "${oci_core_subnet.director_subnet.compartment_id}",
|
||||
"ad" : "${oci_core_subnet.director_subnet.availability_domain}",
|
||||
"vcn": "${var.director_vcn}",
|
||||
"subnet_name" : "${oci_core_subnet.director_subnet.display_name}",
|
||||
"subnet_cidr" : "${oci_core_subnet.director_subnet.cidr_block}",
|
||||
"subnet_gw" : "${cidrhost(oci_core_subnet.director_subnet.cidr_block, 1)}",
|
||||
"director_ip" : "${cidrhost(oci_core_subnet.director_subnet.cidr_block, 2)}"
|
||||
|
||||
}
|
||||
EOS
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,7 @@
|
||||
provider "oci" {
|
||||
tenancy_ocid = "${var.oracle_tenancy_ocid}"
|
||||
user_ocid = "${var.oracle_user_ocid}"
|
||||
fingerprint = "${var.oracle_fingerprint}"
|
||||
private_key_path = "${var.oracle_private_key_path}"
|
||||
region = "${var.oracle_region}"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# Authentication
|
||||
variable "oracle_tenancy_ocid" {}
|
||||
variable "oracle_user_ocid" {}
|
||||
variable "oracle_fingerprint" {}
|
||||
variable "oracle_private_key_path" {}
|
||||
|
||||
# Compartment to create resources in
|
||||
variable "director_compartment_name" {}
|
||||
variable "director_vcn" {}
|
||||
|
||||
# Cloud services
|
||||
variable oracle_region {
|
||||
default = "us-phoenix-1"
|
||||
}
|
||||
|
||||
# Networking
|
||||
variable "vcn_cidr" {
|
||||
default = "10.0.0.0/16"
|
||||
}
|
||||
|
||||
variable "director_subnet_cidr" {
|
||||
}
|
||||
|
||||
variable "director_ad" {
|
||||
default = "WZYX:PHX-AD-1"
|
||||
}
|
||||
|
||||
variable "bats_subnet1_cidr" {
|
||||
}
|
||||
|
||||
variable "bats_subnet2_cidr" {
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get list of Availability Domains
|
||||
data "oci_identity_availability_domains" "ADs" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
}
|
||||
|
||||
# Get name of Availability Domains
|
||||
data "template_file" "deployment_ad" {
|
||||
count = "${length(var.AD)}"
|
||||
template = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[count.index] - 1], "name")}"
|
||||
}
|
||||
|
||||
# Get list of Fault Domains
|
||||
data "oci_identity_fault_domains" "fds" {
|
||||
count = "${length(var.AD)}"
|
||||
availability_domain = "${element(data.template_file.deployment_ad.*.rendered, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
}
|
||||
|
||||
locals {
|
||||
fds = "${flatten(concat(data.oci_identity_fault_domains.fds.*.fault_domains))}"
|
||||
faultdomains_per_ad = 3
|
||||
}
|
||||
|
||||
# Get name of Fault Domains
|
||||
data "template_file" "deployment_fd" {
|
||||
template = "$${name}"
|
||||
count = "${length(var.AD) * (local.faultdomains_per_ad) }"
|
||||
vars = {
|
||||
name = "${lookup(local.fds[count.index], "name")}"
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Oracle Linux image
|
||||
data "oci_core_images" "InstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.InstanceOS}"
|
||||
operating_system_version = "${var.linux_os_version}"
|
||||
filter {
|
||||
name = "display_name"
|
||||
values = ["^.*Oracle[^G]*$"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
|
||||
# Get swift object storage name for Service Gateway
|
||||
data "oci_core_services" "svcgtw_services" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = [".*Object.*Storage"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
// VCN is /16
|
||||
bastion_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 0)}"
|
||||
lb_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 1)}"
|
||||
app_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 2)}"
|
||||
db_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 3)}"
|
||||
}
|
||||
|
||||
# Create Virtual Cloud Network (VCN)
|
||||
module "create_vcn" {
|
||||
source = "./modules/network/vcn"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
vcn_cidr = "${var.vcn_cidr}"
|
||||
vcn_dns_label = "${var.vcn_dns_label}"
|
||||
}
|
||||
|
||||
# Create bastion host subnet
|
||||
module "bastion_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.bastion_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.bastion_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.bastion_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "bassubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PublicRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.BastionSecList.id}"]
|
||||
private_subnet = "False"
|
||||
}
|
||||
|
||||
# Create Load balancer subnet
|
||||
module "lb_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "lbsubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.LBSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
|
||||
# Create Application subnet
|
||||
module "app_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.app_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.app_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.app_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "appsubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.AppSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
|
||||
# Create Database system subnet
|
||||
module "db_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "dbsubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.DBSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
|
||||
# Create bastion host
|
||||
module "create_bastion" {
|
||||
source = "./modules/bastion"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
bastion_hostname_prefix = "${var.ebs_env_prefix}bas${substr(var.region, 3, 3)}"
|
||||
bastion_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
bastion_instance_shape = "${var.bastion_instance_shape}"
|
||||
bastion_subnet = ["${module.bastion_subnet.subnetid}"]
|
||||
bastion_ssh_public_key = "${var.bastion_ssh_public_key}"
|
||||
}
|
||||
|
||||
# Create Application server
|
||||
module "create_app" {
|
||||
source = "./modules/compute"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
compute_instance_count = "${var.ebs_app_instance_count}"
|
||||
compute_hostname_prefix = "${var.ebs_env_prefix}app${substr(var.region, 3, 3)}"
|
||||
compute_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
compute_instance_shape = "${var.ebs_app_instance_shape}"
|
||||
compute_subnet = ["${module.app_subnet.subnetid}"]
|
||||
compute_ssh_public_key = "${var.ssh_public_key}"
|
||||
compute_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${module.create_bastion.Bastion_Public_IPs[0]}"
|
||||
compute_instance_listen_port = "${var.ebs_app_instance_listen_port}"
|
||||
fss_instance_prefix = "${var.ebs_env_prefix}fss${substr(var.region, 3, 3)}"
|
||||
fss_subnet = ["${module.app_subnet.subnetid}"]
|
||||
fss_primary_mount_path = "${var.ebs_fss_primary_mount_path}"
|
||||
fss_limit_size_in_gb = "${var.ebs_fss_limit_size_in_gb}"
|
||||
compute_instance_user = "${var.compute_instance_user}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
compute_boot_volume_size_in_gb = "${var.compute_boot_volume_size_in_gb}"
|
||||
timezone = "${var.timezone}"
|
||||
}
|
||||
|
||||
# Create Database system
|
||||
module "create_db" {
|
||||
source = "./modules/dbsystem"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
db_edition = "${var.db_edition}"
|
||||
db_instance_shape = "${var.db_instance_shape}"
|
||||
db_node_count = "${var.db_node_count}"
|
||||
db_hostname_prefix = "${var.ebs_env_prefix}db${substr(var.region, 3, 3)}"
|
||||
db_size_in_gb = "${var.db_size_in_gb}"
|
||||
db_license_model = "${var.db_license_model}"
|
||||
db_subnet = ["${module.db_subnet.subnetid}"]
|
||||
db_ssh_public_key = "${var.ssh_public_key}"
|
||||
db_admin_password = "${var.db_admin_password}"
|
||||
db_name = "${var.db_name}"
|
||||
db_characterset = "${var.db_characterset}"
|
||||
db_nls_characterset = "${var.db_nls_characterset}"
|
||||
db_version = "${var.db_version}"
|
||||
db_pdb_name = "${var.db_pdb_name}"
|
||||
}
|
||||
|
||||
# Create Load Balancer
|
||||
module "create_lb" {
|
||||
source = "./modules/loadbalancer"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
load_balancer_shape = "${var.load_balancer_shape}"
|
||||
load_balancer_subnet = ["${module.lb_subnet.subnetid}"]
|
||||
load_balancer_name = "${var.ebs_env_prefix}lb${substr(var.region, 3, 3)}"
|
||||
load_balancer_hostname = "${var.load_balancer_hostname}"
|
||||
load_balancer_listen_port = "${var.load_balancer_listen_port}"
|
||||
compute_instance_listen_port = "${var.ebs_app_instance_listen_port}"
|
||||
compute_instance_count = "${var.ebs_app_instance_count}"
|
||||
be_ip_addresses = ["${module.create_app.AppsPrvIPs}"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "Bastion_Public_IPs" {
|
||||
value = ["${oci_core_instance.bastion.*.public_ip}"]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "bastion" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
count = "${length(var.availability_domain)}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
display_name = "${var.bastion_hostname_prefix}${element(var.AD,count.index)}${count.index+1}"
|
||||
shape = "${var.bastion_instance_shape}"
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = "${element(var.bastion_subnet, count.index)}"
|
||||
display_name = "${var.bastion_hostname_prefix}${element(var.AD,count.index)}${count.index+1}"
|
||||
assign_public_ip = true
|
||||
hostname_label = "${var.bastion_hostname_prefix}${element(var.AD,count.index)}${count.index+1}"
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = "${var.bastion_image}"
|
||||
boot_volume_size_in_gbs = "60"
|
||||
}
|
||||
|
||||
metadata {
|
||||
ssh_authorized_keys = "${trimspace(file("${var.bastion_ssh_public_key}"))}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "AD" {
|
||||
description = "Availability domain"
|
||||
type= "list"
|
||||
}
|
||||
|
||||
# Bastion host variables
|
||||
variable "bastion_hostname_prefix" {
|
||||
description = "Prefix for bastion hostname"
|
||||
}
|
||||
|
||||
variable "bastion_instance_shape" {
|
||||
description = "Instance shape of bastion host"
|
||||
}
|
||||
|
||||
variable "bastion_subnet" {
|
||||
description = "Subnet for Bastion host"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "bastion_image" {
|
||||
description ="Bation Operating System Image"
|
||||
}
|
||||
variable "bastion_ssh_public_key" {
|
||||
description = "Bastion Host SSH public key"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
ebsfss_private_ips = "${flatten(concat(data.oci_core_private_ips.ip_mount_target.*.private_ips))}"
|
||||
}
|
||||
|
||||
locals {
|
||||
ebsfss_exports = [
|
||||
"${oci_file_storage_export.fss_exp.*.path}",
|
||||
]
|
||||
ebsfss_fstabs = "${formatlist("%s:%s", data.template_file.ebsfss_ips.*.rendered, oci_file_storage_export.fss_exp.*.path)}"
|
||||
}
|
||||
|
||||
|
||||
# Get private IP of File Storage Service
|
||||
data "oci_core_private_ips" "ip_mount_target" {
|
||||
count = "${length(var.availability_domain)}"
|
||||
subnet_id = "${element(oci_file_storage_mount_target.fss_mt.*.subnet_id, count.index)}"
|
||||
|
||||
filter {
|
||||
name = "id"
|
||||
values = ["${element(flatten(oci_file_storage_mount_target.fss_mt.*.private_ip_ids), count.index)}"]
|
||||
}
|
||||
}
|
||||
|
||||
data "template_file" "ebsfss_ips" {
|
||||
template = "$${ip_address}"
|
||||
count = "${length(var.availability_domain)}"
|
||||
|
||||
vars = {
|
||||
ip_address = "${lookup(local.ebsfss_private_ips[count.index], "ip_address")}"
|
||||
}
|
||||
}
|
||||
|
||||
# Get Filesystem details
|
||||
data "template_file" "bootstrap" {
|
||||
template = "${file("${path.module}/userdata/bootstrap.tpl")}"
|
||||
vars {
|
||||
src_mount_path = "${var.fss_primary_mount_path}/"
|
||||
src_mount_target_private_ip = "${element(data.template_file.ebsfss_ips.*.rendered, 0)}"
|
||||
src_export_path = "${element(oci_file_storage_export.fss_exp.*.path,0)}"
|
||||
app_instance_listen_port = "${var.compute_instance_listen_port}"
|
||||
timezone = "${var.timezone}"
|
||||
}
|
||||
}
|
||||
|
||||
# Get rsync inputs
|
||||
data "template_file" "rsync" {
|
||||
count = "${local.enable_rsync ? 1 : 0}"
|
||||
template = "${file("${path.module}/userdata/rsync.sh")}"
|
||||
vars {
|
||||
src_mount_path = "${var.fss_primary_mount_path}/"
|
||||
dst_export_path = "${element(oci_file_storage_export.fss_exp.*.path,1)}"
|
||||
dst_mount_target_private_ip = "${element(data.template_file.ebsfss_ips.*.rendered, 1)}"
|
||||
dst_mount_path = "${var.fss_primary_mount_path}DR/"
|
||||
fss_sync_frequency = "*/30 * * * *"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "AppsPrvIPs" {
|
||||
description = "Application private IPs"
|
||||
value = ["${oci_core_instance.compute.*.private_ip}"]
|
||||
}
|
||||
|
||||
|
||||
output "FSSFstabs" {
|
||||
description = "FSS /etc/fstab Entries"
|
||||
value = "${local.ebsfss_fstabs}"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "random_integer" "rand" {
|
||||
min = 1000000000
|
||||
max = 9999999999
|
||||
}
|
||||
|
||||
locals {
|
||||
enable_rsync = "${length(var.availability_domain) >= "2" ? 1 : 0}"
|
||||
}
|
||||
|
||||
|
||||
# Enable rsync
|
||||
resource "null_resource" "enable_rsync" {
|
||||
depends_on = ["oci_core_instance.compute",
|
||||
"oci_file_storage_export.fss_exp"]
|
||||
count = "${local.enable_rsync ? var.compute_instance_count : 0}"
|
||||
|
||||
provisioner "file" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "${var.timeout}"
|
||||
host = "${oci_core_instance.compute.*.private_ip[count.index % var.compute_instance_count]}"
|
||||
user = "${var.compute_instance_user}"
|
||||
private_key = "${file("${var.compute_ssh_private_key}")}"
|
||||
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
bastion_private_key = "${file("${var.bastion_ssh_private_key}")}"
|
||||
}
|
||||
|
||||
content = "${data.template_file.rsync.rendered}"
|
||||
destination = "/tmp/rsync_${random_integer.rand.result}.sh"
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = "sleep 120" # Wait for cloud-init to complete
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "${var.timeout}"
|
||||
host = "${oci_core_instance.compute.*.private_ip[count.index % var.compute_instance_count]}"
|
||||
user = "${var.compute_instance_user}"
|
||||
private_key = "${file("${var.compute_ssh_private_key}")}"
|
||||
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
bastion_private_key = "${file("${var.bastion_ssh_private_key}")}"
|
||||
}
|
||||
|
||||
inline = [
|
||||
"chmod +x /tmp/rsync_${random_integer.rand.result}.sh",
|
||||
"while [ ! -f /tmp/rsync.done ]; do /tmp/rsync_${random_integer.rand.result}.sh; sleep 10; done",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "compute" {
|
||||
count = "${var.compute_instance_count}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
display_name = "${var.compute_hostname_prefix}${element(var.AD,count.index)}${count.index + 1}"
|
||||
fault_domain = "${element(var.fault_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
shape = "${var.compute_instance_shape}"
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = "${element(var.compute_subnet, count.index)}"
|
||||
display_name = "${var.compute_hostname_prefix}${element(var.AD,count.index)}${count.index + 1}"
|
||||
assign_public_ip = false
|
||||
hostname_label = "${var.compute_hostname_prefix}${element(var.AD,count.index)}${count.index + 1}"
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = "${var.compute_image}"
|
||||
boot_volume_size_in_gbs = "${var.compute_boot_volume_size_in_gb}"
|
||||
}
|
||||
|
||||
metadata {
|
||||
ssh_authorized_keys = "${trimspace(file("${var.compute_ssh_public_key}"))}"
|
||||
user_data = "${base64encode(data.template_file.bootstrap.rendered)}"
|
||||
}
|
||||
|
||||
timeouts {
|
||||
create = "${var.timeout}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "compute_instance_count" {
|
||||
description = "Application instance count"
|
||||
}
|
||||
variable "compute_instance_shape" {
|
||||
description = "Application instance shape"
|
||||
}
|
||||
variable "compute_hostname_prefix" {
|
||||
description = "Application hostname prefix"
|
||||
}
|
||||
variable "compute_image" {
|
||||
description = "OS Image"
|
||||
}
|
||||
variable "compute_ssh_private_key" {
|
||||
description = "SSH private key"
|
||||
}
|
||||
variable "compute_ssh_public_key" {
|
||||
description = "SSH public key"
|
||||
}
|
||||
variable "compute_instance_listen_port" {
|
||||
description = "Application instance listen port"
|
||||
}
|
||||
variable "bastion_ssh_private_key" {
|
||||
description = "SSH key"
|
||||
}
|
||||
variable "compute_subnet" {
|
||||
description = "subnet"
|
||||
type = "list"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability Domainr"
|
||||
type = "list"
|
||||
}
|
||||
variable "fault_domain" {
|
||||
description = "Fault Domainr"
|
||||
type = "list"
|
||||
}
|
||||
variable "AD" {
|
||||
description = "Availability Domain number"
|
||||
type = "list"
|
||||
}
|
||||
variable "bastion_public_ip" {
|
||||
description = "Public IP of bastion instance"
|
||||
}
|
||||
variable "fss_primary_mount_path" {
|
||||
description = "Mountpoint for primary application servers"
|
||||
}
|
||||
variable "fss_instance_prefix" {
|
||||
description = "FSS instance name prefix"
|
||||
}
|
||||
variable "fss_subnet" {
|
||||
description = "FSS subnet"
|
||||
type = "list"
|
||||
}
|
||||
variable "fss_limit_size_in_gb" {}
|
||||
variable "timeout" {
|
||||
description = "Timeout setting for resource creation "
|
||||
default = "20m"
|
||||
}
|
||||
variable "compute_instance_user" {
|
||||
description = "Login user for compute instance"
|
||||
}
|
||||
variable "compute_boot_volume_size_in_gb" {
|
||||
description = "Boot volume size of compute instance"
|
||||
}
|
||||
variable "timezone" {
|
||||
description = "Set timezone for compute instance"
|
||||
}
|
||||
variable "bastion_user" {
|
||||
description = "Login user for bastion host"
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Filesystem
|
||||
resource "oci_file_storage_file_system" "fss" {
|
||||
count = "${length(var.availability_domain)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
display_name = "${var.fss_instance_prefix}${var.AD[count.index]}"
|
||||
}
|
||||
|
||||
# Mount Target
|
||||
resource "oci_file_storage_mount_target" "fss_mt" {
|
||||
depends_on = ["oci_file_storage_file_system.fss"]
|
||||
count = "${length(var.availability_domain)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
hostname_label = "${var.fss_instance_prefix}${var.AD[count.index]}"
|
||||
subnet_id = "${element(var.fss_subnet, count.index)}"
|
||||
display_name = "${var.fss_instance_prefix}${var.AD[count.index]}_mt"
|
||||
}
|
||||
|
||||
# Filesystem exportset
|
||||
resource "oci_file_storage_export_set" "fss_expset" {
|
||||
depends_on = ["oci_file_storage_file_system.fss", "oci_file_storage_mount_target.fss_mt"]
|
||||
count = "${length(var.availability_domain)}"
|
||||
mount_target_id = "${element(oci_file_storage_mount_target.fss_mt.*.id, count.index)}"
|
||||
max_fs_stat_bytes = "${(var.fss_limit_size_in_gb * 1024 * 1024 * 1024)}"
|
||||
}
|
||||
|
||||
# Filesystem export
|
||||
resource "oci_file_storage_export" "fss_exp" {
|
||||
depends_on = ["oci_file_storage_file_system.fss", "oci_file_storage_mount_target.fss_mt"]
|
||||
count = "${length(var.availability_domain)}"
|
||||
export_set_id = "${element(oci_file_storage_mount_target.fss_mt.*.export_set_id,count.index)}"
|
||||
file_system_id = "${element(oci_file_storage_file_system.fss.*.id, count.index)}"
|
||||
path = "/${var.fss_instance_prefix}${var.AD[count.index]}"
|
||||
|
||||
export_options = [
|
||||
{
|
||||
source = "0.0.0.0/0"
|
||||
access = "READ_WRITE"
|
||||
identity_squash = "NONE"
|
||||
require_privileged_source_port = false
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get CPU and node and node count for a db shape
|
||||
data "oci_database_db_system_shapes" "db_system_shapes" {
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.db_instance_shape}"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_database_db_system" "database" {
|
||||
count = "${length(var.availability_domain)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
cpu_core_count = "${lookup(data.oci_database_db_system_shapes.db_system_shapes.db_system_shapes[0], "minimum_core_count")}"
|
||||
database_edition = "${var.db_edition}"
|
||||
|
||||
db_home {
|
||||
database = {
|
||||
"admin_password" = "${var.db_admin_password}"
|
||||
"db_name" = "${var.db_name}"
|
||||
"character_set" = "${var.db_characterset}"
|
||||
"ncharacter_set" = "${var.db_nls_characterset}"
|
||||
"db_workload" = "${var.db_workload}"
|
||||
"pdb_name" = "${var.db_pdb_name}"
|
||||
}
|
||||
db_version = "${var.db_version}"
|
||||
display_name = "${var.db_name}"
|
||||
}
|
||||
|
||||
shape = "${var.db_instance_shape}"
|
||||
node_count = "${var.db_node_count}"
|
||||
data_storage_size_in_gb = "${var.db_size_in_gb}"
|
||||
license_model = "${var.db_license_model}"
|
||||
disk_redundancy = "${var.db_disk_redundancy}"
|
||||
subnet_id = "${element(var.db_subnet, count.index)}"
|
||||
ssh_public_keys = ["${trimspace(file("${var.db_ssh_public_key}"))}"]
|
||||
display_name = "${var.db_hostname_prefix}${element(var.AD,count.index)}${count.index + 1}"
|
||||
hostname = "${var.db_hostname_prefix}${element(var.AD,count.index)}${count.index + 1}"
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
variable "AD" {
|
||||
description = "Availability domain"
|
||||
type= "list"
|
||||
}
|
||||
variable "db_subnet" {
|
||||
description = "Subnet for Bastion host"
|
||||
type = "list"
|
||||
}
|
||||
# Database System variables
|
||||
variable "db_edition" {
|
||||
description = "Database Edition"
|
||||
}
|
||||
variable "db_version" {
|
||||
description = "Database version"
|
||||
}
|
||||
variable "db_admin_password" {
|
||||
description = "Database admin password"
|
||||
}
|
||||
variable "db_name" {
|
||||
description = "Database Name"
|
||||
}
|
||||
variable "db_disk_redundancy" {
|
||||
description = "Database disk redundancy for Bare Metal DB System"
|
||||
default="NORMAL"
|
||||
}
|
||||
variable "db_hostname_prefix" {
|
||||
description = "Database hostname prefix"
|
||||
}
|
||||
variable "db_instance_shape" {
|
||||
description = "Database system shape"
|
||||
|
||||
}
|
||||
variable "db_ssh_public_key" {
|
||||
description = "Database public ssh key"
|
||||
}
|
||||
|
||||
variable "db_characterset" {
|
||||
description = "Database characterset"
|
||||
}
|
||||
variable "db_nls_characterset" {
|
||||
description = "Database National characterset"
|
||||
}
|
||||
variable "db_workload" {
|
||||
description = "Database Workload"
|
||||
default = "OLTP"
|
||||
}
|
||||
variable "db_pdb_name" {
|
||||
}
|
||||
variable "db_size_in_gb" {
|
||||
description = "Database size in gb"
|
||||
}
|
||||
|
||||
variable "db_license_model" {
|
||||
description = "Database License Model"
|
||||
}
|
||||
variable "db_node_count" {
|
||||
description = "Database Node count"
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Load Balancer
|
||||
resource "oci_load_balancer" "lb" {
|
||||
shape = "${var.load_balancer_shape}"
|
||||
count = "${length(var.availability_domain)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
subnet_ids = ["${element(var.load_balancer_subnet, count.index)}"]
|
||||
display_name = "${var.load_balancer_name}${element(var.AD,count.index)}${count.index+1}"
|
||||
is_private = "${var.load_balancer_private}"
|
||||
}
|
||||
|
||||
# Load Balancer Backendset
|
||||
resource "oci_load_balancer_backend_set" "lb-bset" {
|
||||
depends_on = ["oci_load_balancer.lb"]
|
||||
count = "${length(var.availability_domain)}"
|
||||
name = "${var.load_balancer_name}${element(var.AD,count.index)}-bes${count.index + 1}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, count.index)}"
|
||||
policy = "ROUND_ROBIN"
|
||||
|
||||
health_checker {
|
||||
port = "${var.compute_instance_listen_port}"
|
||||
protocol = "HTTP"
|
||||
response_body_regex = ".*"
|
||||
url_path = "/"
|
||||
}
|
||||
session_persistence_configuration {
|
||||
cookie_name = "lb-sessprs"
|
||||
disable_fallback = true
|
||||
}
|
||||
lifecycle {
|
||||
ignore_changes = ["availability_domain"]
|
||||
}
|
||||
}
|
||||
|
||||
# Load Balancer Backend
|
||||
resource "oci_load_balancer_backend" "lb-bset-be" {
|
||||
depends_on = ["oci_load_balancer.lb", "oci_load_balancer_backend_set.lb-bset"]
|
||||
count = "${var.compute_instance_count}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, count.index)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb-bset.*.name, count.index)}"
|
||||
ip_address = "${element(var.be_ip_addresses, count.index)}"
|
||||
port = "${var.compute_instance_listen_port}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = ["availability_domain"]
|
||||
}
|
||||
}
|
||||
|
||||
# Load Balancer Hostname
|
||||
resource "oci_load_balancer_hostname" "hostname" {
|
||||
depends_on = ["oci_load_balancer.lb"]
|
||||
count = "${length(var.availability_domain)}"
|
||||
hostname = "${var.load_balancer_hostname}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, count.index)}"
|
||||
name = "hostname${count.index + 1}"
|
||||
}
|
||||
|
||||
# Load Balancer Listener
|
||||
resource "oci_load_balancer_listener" "lb-listener" {
|
||||
depends_on = ["oci_load_balancer.lb", "oci_load_balancer_backend_set.lb-bset","oci_load_balancer_hostname.hostname"]
|
||||
count = "${length(var.availability_domain)}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, count.index)}"
|
||||
name = "${var.load_balancer_name}${element(var.AD,count.index)}-lsnr${count.index + 1}"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb-bset.*.name, count.index)}"
|
||||
hostname_names = ["${element(oci_load_balancer_hostname.hostname.*.name, count.index)}"]
|
||||
port = "${var.load_balancer_listen_port}"
|
||||
protocol = "HTTP"
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
variable "AD" {
|
||||
description = "Availability domain"
|
||||
type= "list"
|
||||
}
|
||||
|
||||
# Load Balancer variables
|
||||
variable load_balancer_subnet {
|
||||
description = "Subnet for Load Balancer"
|
||||
type = "list"
|
||||
}
|
||||
variable load_balancer_name {
|
||||
description = "Name of Load Balancer"
|
||||
}
|
||||
variable load_balancer_shape {
|
||||
description = "Shape of Load Balancer"
|
||||
}
|
||||
variable load_balancer_private {
|
||||
description = "Set private load balacer"
|
||||
default = "True"
|
||||
}
|
||||
variable be_ip_addresses {
|
||||
description = "Backend IP addresses"
|
||||
type = "list"
|
||||
}
|
||||
variable load_balancer_hostname {
|
||||
description = "Hostname for Load Balancer"
|
||||
}
|
||||
variable compute_instance_listen_port {
|
||||
description = "Listen port of compute instance"
|
||||
}
|
||||
variable load_balancer_listen_port {
|
||||
description = "Listen port of Load Balancer"
|
||||
}
|
||||
variable compute_instance_count {
|
||||
description = "Number or compute instances"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "subnetid" {
|
||||
value = ["${oci_core_subnet.subnet.*.id}"]
|
||||
}
|
||||
|
||||
output "cidr_block" {
|
||||
value = ["${oci_core_subnet.subnet.*.cidr_block}"]
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Create subnet
|
||||
resource "oci_core_subnet" "subnet" {
|
||||
count = "${length(var.availability_domain)}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
vcn_id = "${var.vcn_id}"
|
||||
cidr_block = "${var.vcn_subnet_cidr[count.index]}"
|
||||
display_name = "${var.dns_label}${var.AD[count.index]}"
|
||||
dns_label = "${var.dns_label}${var.AD[count.index]}"
|
||||
dhcp_options_id = "${var.dhcp_options_id}"
|
||||
route_table_id = "${var.route_table_id}"
|
||||
security_list_ids = ["${var.security_list_ids}"]
|
||||
prohibit_public_ip_on_vnic = "${var.private_subnet}"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
/*
|
||||
variable "tenancy_ocid" {
|
||||
description = "OCI Tenancy OCID"
|
||||
}*/
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
variable "AD" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
# Virtual Cloud Network (VCN) variables
|
||||
variable "vcn_id" {
|
||||
description = "VCN OCID"
|
||||
}
|
||||
variable "route_table_id" {
|
||||
description = "VCN Route Table OCID"
|
||||
}
|
||||
|
||||
variable "dhcp_options_id" {
|
||||
description = "VCN DHCP options OCID"
|
||||
}
|
||||
variable "vcn_subnet_cidr" {
|
||||
description = "CIDR for VCN subnet"
|
||||
type = "list"
|
||||
}
|
||||
variable "security_list_ids" {
|
||||
description = "Security List OCID"
|
||||
type = "list"
|
||||
}
|
||||
variable "dns_label" {
|
||||
description = "VCN DNS Label"
|
||||
}
|
||||
variable "private_subnet" {
|
||||
description = "Whether private or public subnet"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get name of object storage
|
||||
data "oci_core_services" "svcgtw_services" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = [".*Object.*Storage"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "vcnid" {
|
||||
description = "ocid of VCN"
|
||||
value = "${oci_core_virtual_network.vcn.id}"
|
||||
}
|
||||
output "default_dhcp_id" {
|
||||
description = "ocid of default DHCP options"
|
||||
value = "${oci_core_virtual_network.vcn.default_dhcp_options_id}"
|
||||
}
|
||||
|
||||
output "igw_id" {
|
||||
description = "ocid of internet gateway"
|
||||
value = "${oci_core_internet_gateway.igw.id}"
|
||||
}
|
||||
|
||||
output "natgtw_id" {
|
||||
description = "ocid of service gateway"
|
||||
value = "${oci_core_nat_gateway.natgtw.id}"
|
||||
}
|
||||
output "svcgtw_id" {
|
||||
description = "ocid of service gateway"
|
||||
value = "${oci_core_service_gateway.svcgtw.id}"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Virtual Cloud Network (VCN)
|
||||
resource "oci_core_virtual_network" "vcn" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
cidr_block = "${var.vcn_cidr}"
|
||||
dns_label = "${var.vcn_dns_label}"
|
||||
display_name = "${var.vcn_dns_label}"
|
||||
}
|
||||
|
||||
|
||||
# Internet Gateway
|
||||
resource "oci_core_internet_gateway" "igw" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}igw"
|
||||
}
|
||||
|
||||
# NAT (Network Address Translation) Gateway
|
||||
resource "oci_core_nat_gateway" "natgtw" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}natgtw"
|
||||
}
|
||||
|
||||
|
||||
# Service Gateway
|
||||
resource "oci_core_service_gateway" "svcgtw" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
|
||||
services {
|
||||
service_id = "${lookup(data.oci_core_services.svcgtw_services.services[0], "id")}"
|
||||
}
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}svcgtw"
|
||||
}
|
||||
|
||||
# Dynamic Routing Gateway (DRG)
|
||||
resource "oci_core_drg" "drg" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
display_name = "${var.vcn_dns_label}drg"
|
||||
}
|
||||
resource "oci_core_drg_attachment" "drg_attachment" {
|
||||
drg_id = "${oci_core_drg.drg.id}"
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}drgattchmt"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment OCID"
|
||||
}
|
||||
|
||||
# VCN Variables
|
||||
variable "vcn_cidr" {
|
||||
description = "VCN CIDR"
|
||||
}
|
||||
variable "vcn_dns_label" {
|
||||
description = "VCN DNS Label"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "BastionPublicIPs" {
|
||||
value = ["${module.create_bastion.Bastion_Public_IPs}"]
|
||||
}
|
||||
|
||||
output "ApplicationPrivateIPs" {
|
||||
value = ["${module.create_app.AppsPrvIPs}"]
|
||||
}
|
||||
|
||||
output "FSSDetails" {
|
||||
value = ["${module.create_app.FSSFstabs}"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
# Terraform version
|
||||
|
||||
terraform {
|
||||
required_version = ">= 0.11.8"
|
||||
}
|
||||
|
||||
# Oracle Cloud Infrastructure (OCI) Provider
|
||||
|
||||
provider "oci" {
|
||||
version = "=3.5.0"
|
||||
tenancy_ocid = "${var.tenancy_ocid}"
|
||||
user_ocid = "${var.user_ocid}"
|
||||
fingerprint = "${var.fingerprint}"
|
||||
private_key_path = "${var.private_key_path}"
|
||||
region = "${var.region}"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
# Public Route Table
|
||||
resource "oci_core_route_table" "PublicRT" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = module.create_vcn.vcnid
|
||||
display_name = "${var.vcn_dns_label}pubrt"
|
||||
|
||||
route_rules {
|
||||
destination = local.anywhere
|
||||
network_entity_id = module.create_vcn.igw_id
|
||||
}
|
||||
}
|
||||
|
||||
# Private Route Table
|
||||
resource "oci_core_route_table" "PrivateRT" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = module.create_vcn.vcnid
|
||||
display_name = "${var.vcn_dns_label}pvtrt"
|
||||
|
||||
route_rules {
|
||||
destination = lookup(data.oci_core_services.svcgtw_services.services[0], "cidr_block")
|
||||
destination_type = "SERVICE_CIDR_BLOCK"
|
||||
network_entity_id = module.create_vcn.svcgtw_id
|
||||
}
|
||||
route_rules {
|
||||
destination = local.anywhere
|
||||
destination_type = "CIDR_BLOCK"
|
||||
network_entity_id = module.create_vcn.natgtw_id
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
tcp_protocol = "6"
|
||||
udp_protocol = "17"
|
||||
all_protocols = "all"
|
||||
anywhere = "0.0.0.0/0"
|
||||
db_port = "1521"
|
||||
ssh_port = "22"
|
||||
app_ports = ["7201", "7202", "7401", "7402", "7601", "7602", "7001", "7002"]
|
||||
fss_ports = ["2048", "2050", "111"]
|
||||
}
|
||||
|
||||
# Bastion Security List
|
||||
resource "oci_core_security_list" "BastionSecList" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "BastionSecList"
|
||||
vcn_id = module.create_vcn.vcnid
|
||||
|
||||
egress_security_rules = [
|
||||
{
|
||||
protocol = "${local.tcp_protocol}"
|
||||
destination = "${local.anywhere}"
|
||||
},
|
||||
]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${local.ssh_port}"
|
||||
"max" = "${local.ssh_port}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${local.anywhere}"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
# Database System Security List
|
||||
resource "oci_core_security_list" "DBSecList" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "DBSecList"
|
||||
vcn_id = module.create_vcn.vcnid
|
||||
|
||||
egress_security_rules = [
|
||||
{
|
||||
protocol = "${local.tcp_protocol}"
|
||||
destination = "${local.anywhere}"
|
||||
},
|
||||
]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${local.ssh_port}"
|
||||
"max" = "${local.ssh_port}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${local.db_port}"
|
||||
"max" = "${local.db_port}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
# Application Security List
|
||||
resource "oci_core_security_list" "AppSecList" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "AppSecList"
|
||||
vcn_id = module.create_vcn.vcnid
|
||||
|
||||
egress_security_rules = [
|
||||
{
|
||||
protocol = "${local.tcp_protocol}"
|
||||
destination = "${local.anywhere}"
|
||||
},
|
||||
]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${local.ssh_port}"
|
||||
"max" = "${local.ssh_port}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${var.ebs_app_instance_listen_port}"
|
||||
"max" = "${var.ebs_app_instance_listen_port}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${local.fss_ports[0]}"
|
||||
"max" = "${local.fss_ports[1]}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${local.fss_ports[2]}"
|
||||
"max" = "${local.fss_ports[2]}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
udp_options = {
|
||||
"min" = "${local.fss_ports[0]}"
|
||||
"max" = "${local.fss_ports[0]}"
|
||||
}
|
||||
|
||||
protocol = "${local.udp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
udp_options = {
|
||||
"min" = "${local.fss_ports[2]}"
|
||||
"max" = "${local.fss_ports[2]}"
|
||||
}
|
||||
|
||||
protocol = "${local.udp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
# Load Balancer Security List
|
||||
resource "oci_core_security_list" "LBSecList" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "LBSecList"
|
||||
vcn_id = module.create_vcn.vcnid
|
||||
|
||||
egress_security_rules = [
|
||||
{
|
||||
protocol = "${local.tcp_protocol}"
|
||||
destination = "${local.anywhere}"
|
||||
},
|
||||
]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
tcp_options = {
|
||||
"min" = "${var.load_balancer_listen_port}"
|
||||
"max" = "${var.load_balancer_listen_port}"
|
||||
}
|
||||
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${local.anywhere}"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# AD (Availability Domain to use for creating EBS infrastructure)
|
||||
AD = "[<Availability domains in double quotes separated by commas>]"
|
||||
|
||||
# CIDR block of VCN to be created
|
||||
vcn_cidr = "<CIDR of VCN>"
|
||||
|
||||
# DNS label of VCN to be created
|
||||
vcn_dns_label = "<DNS of VCN>"
|
||||
|
||||
# Operating system version to be used for application instances
|
||||
linux_os_version = "<Operating System version of Linux>"
|
||||
|
||||
# Timezone of compute instance
|
||||
timezone = "<timezone>"
|
||||
|
||||
# Login user for bastion host
|
||||
bastion_user = "<Operating System user for bastion host>"
|
||||
|
||||
# Size of boot volume (in gb) of application instances
|
||||
compute_boot_volume_size_in_gb = "<Boot volume size in gb>"
|
||||
|
||||
# Login user for compute instance
|
||||
compute_instance_user = "<Operating System user for compute instance>"
|
||||
|
||||
#Environment prefix to define name of resources
|
||||
ebs_env_prefix = "<Environment prefix>"
|
||||
|
||||
# Number of application instances to be created
|
||||
ebs_app_instance_count = "<Number of application nodes>"
|
||||
|
||||
# Shape of app instance
|
||||
ebs_app_instance_shape = "<Application instance shape>"
|
||||
|
||||
# Listen port of the application instance
|
||||
ebs_app_instance_listen_port = "<Application instance listen port>"
|
||||
|
||||
# Mount path for application filesystem
|
||||
ebs_fss_primary_mount_path = "<Path of primary application filesystem>"
|
||||
|
||||
# Set filesystem limit
|
||||
ebs_fss_limit_size_in_gb = "<Upper soft limit of FSS in gb>"
|
||||
|
||||
# Datbase Edition
|
||||
db_edition = "<Database Edition>"
|
||||
|
||||
# Licensing model for database
|
||||
db_license_model = "<Database license model>"
|
||||
|
||||
# Database version
|
||||
db_version = "<Database version>"
|
||||
|
||||
# Number of database nodes
|
||||
db_node_count = "<Number of database Nodes (1 for Single instance and 2 for RAC)>"
|
||||
|
||||
#Shape of Database nodes
|
||||
db_instance_shape = "<Database node shape>"
|
||||
|
||||
#Database name
|
||||
db_name = "<Database Name>"
|
||||
|
||||
#Size of Database
|
||||
db_size_in_gb = "<Data size in GB>"
|
||||
|
||||
# Database administration (sys) password
|
||||
db_admin_password = "<Database sys password>"
|
||||
|
||||
# Characterset of database
|
||||
db_characterset = "<Database characterset>"
|
||||
|
||||
# National Characterset of database
|
||||
db_nls_characterset = "<Database National characterset>"
|
||||
|
||||
# Pluggable database name
|
||||
db_pdb_name = "<Pluggable database name>"
|
||||
|
||||
# Hostname of Load Balancer
|
||||
load_balancer_hostname = "<Load balancer hostname>"
|
||||
|
||||
# Shape of Load Balancer
|
||||
load_balancer_shape = "<Load Balancer shape>"
|
||||
|
||||
#Listen port of load balancer
|
||||
load_balancer_listen_port = "<Load balancer listen port>"
|
||||
@@ -0,0 +1,151 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "tenancy_ocid" {}
|
||||
variable "region" {}
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
variable "AD" {
|
||||
description = "Availbility domain number"
|
||||
type = "list"
|
||||
}
|
||||
variable "user_ocid" {}
|
||||
variable "fingerprint" {}
|
||||
variable "private_key_path" {}
|
||||
variable "ssh_public_key" {
|
||||
description = "SSH public key for instances"
|
||||
}
|
||||
variable "ssh_private_key" {
|
||||
description = "SSH private key for instances"
|
||||
}
|
||||
|
||||
variable "bastion_ssh_public_key" {
|
||||
description = "SSH public key for bastion instance"
|
||||
}
|
||||
variable "bastion_ssh_private_key" {
|
||||
description = "SSH private key for bastion_instance"
|
||||
}
|
||||
variable "InstanceOS" {
|
||||
description = "Operating system for compute instances"
|
||||
default = "Oracle Linux"
|
||||
}
|
||||
variable "linux_os_version" {
|
||||
description = "Operating system version for compute instances except NAT"
|
||||
default = "7.5"
|
||||
}
|
||||
|
||||
# VCN variables
|
||||
variable "vcn_cidr" {
|
||||
description = "CIDR for Virtual Cloud Network (VCN)"
|
||||
}
|
||||
variable "vcn_dns_label" {
|
||||
description = "DNS label for Virtual Cloud Network (VCN)"
|
||||
}
|
||||
|
||||
# Bastion host variables
|
||||
variable "bastion_instance_shape" {
|
||||
description = "Instance shape of bastion host"
|
||||
default = "VM.Standard2.1"
|
||||
}
|
||||
|
||||
# Application Server variables
|
||||
variable "ebs_env_prefix" {
|
||||
}
|
||||
|
||||
variable "ebs_app_instance_count" {
|
||||
description = "Application Server count"
|
||||
}
|
||||
|
||||
variable "ebs_app_instance_shape" {
|
||||
description = "Application Instance shape"
|
||||
}
|
||||
variable "ebs_app_instance_listen_port" {
|
||||
description = "Application instance listen port"
|
||||
}
|
||||
|
||||
variable "ebs_fss_primary_mount_path" {
|
||||
description = "Mountpoint for primary application servers"
|
||||
}
|
||||
|
||||
variable "ebs_fss_limit_size_in_gb" {
|
||||
description = "Mountpoint for primary application servers"
|
||||
}
|
||||
|
||||
variable "compute_boot_volume_size_in_gb" {
|
||||
description = "Boot volume size of application servers"
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Set timezone for servers"
|
||||
}
|
||||
|
||||
# Database variables
|
||||
variable "db_edition" {
|
||||
description = "DB Edition"
|
||||
default = "ENTERPRISE_EDITION_EXTREME_PERFORMANCE"
|
||||
}
|
||||
|
||||
variable "db_instance_shape" {
|
||||
description = "DB Instance shape"
|
||||
}
|
||||
|
||||
variable "db_node_count" {
|
||||
description = "Number of DB Nodes"
|
||||
}
|
||||
variable "db_size_in_gb" {
|
||||
description = "Size of database in GB"
|
||||
}
|
||||
variable "db_license_model" {
|
||||
description = "Database License model"
|
||||
}
|
||||
|
||||
variable "db_admin_password" {
|
||||
description = "Database Admin password"
|
||||
}
|
||||
variable "db_name" {
|
||||
description = "Database Name"
|
||||
}
|
||||
variable "db_characterset" {
|
||||
description = "Database Characterset"
|
||||
}
|
||||
variable "db_nls_characterset" {
|
||||
description = "Database National Characterset"
|
||||
}
|
||||
|
||||
variable "db_version" {
|
||||
description = "Database version"
|
||||
}
|
||||
variable "db_pdb_name" {
|
||||
description = "Pluggable database Name"
|
||||
}
|
||||
|
||||
variable load_balancer_shape {
|
||||
description = "Load Balancer shape"
|
||||
}
|
||||
variable load_balancer_private {
|
||||
description = "Whether private Load balancer"
|
||||
default = true
|
||||
}
|
||||
variable load_balancer_hostname {
|
||||
description = "Load Balancer hostname"
|
||||
}
|
||||
|
||||
variable load_balancer_listen_port {
|
||||
description = "Load balancer listen port"
|
||||
}
|
||||
|
||||
variable "timeout" {
|
||||
description = "Timeout setting for resource creation"
|
||||
default = "10m"
|
||||
}
|
||||
|
||||
variable "compute_instance_user" {
|
||||
description = "Login user for application instance"
|
||||
}
|
||||
|
||||
variable "bastion_user" {
|
||||
description = "Login user for bastion host"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "Bastion_Public_IPs" {
|
||||
value = ["${oci_core_instance.bastion.*.public_ip}"]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "bastion" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
count = "${length(var.availability_domain)}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
display_name = "${var.bastion_hostname_prefix}${count.index+1}"
|
||||
shape = "${var.bastion_instance_shape}"
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = "${element(var.bastion_subnet, count.index)}"
|
||||
display_name = "${var.bastion_hostname_prefix}${count.index+1}"
|
||||
assign_public_ip = true
|
||||
hostname_label = "${var.bastion_hostname_prefix}${count.index+1}"
|
||||
}
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = "${var.bastion_image}"
|
||||
boot_volume_size_in_gbs = "60"
|
||||
}
|
||||
metadata {
|
||||
ssh_authorized_keys = "${trimspace(file(var.bastion_ssh_public_key))}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
type = "list"
|
||||
description = "Availability domain"
|
||||
}
|
||||
|
||||
variable "AD" {
|
||||
type= "list"
|
||||
}
|
||||
#Bastion host variables
|
||||
variable "bastion_hostname_prefix" {}
|
||||
|
||||
variable "bastion_instance_shape" {
|
||||
description = "Instance shape of bastion host"
|
||||
}
|
||||
|
||||
variable "bastion_subnet" {
|
||||
type = "list"
|
||||
description = "Subnet for Bastion host"
|
||||
}
|
||||
|
||||
variable "bastion_image" {
|
||||
description ="OS Image"
|
||||
}
|
||||
|
||||
variable "bastion_ssh_public_key" {
|
||||
description = "Bastion Host SSH public key"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get list of Availability Domains
|
||||
data "oci_identity_availability_domains" "ADs" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
}
|
||||
|
||||
# Get name of Availability Domains
|
||||
data "template_file" "deployment_ad" {
|
||||
count = "${length(var.AD)}"
|
||||
template = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[count.index] - 1], "name")}"
|
||||
}
|
||||
|
||||
|
||||
# Get latest Oracle Linux image
|
||||
data "oci_core_images" "InstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.InstanceOS}"
|
||||
operating_system_version = "${var.linux_os_version}"
|
||||
filter {
|
||||
name = "display_name"
|
||||
values = ["^.*Oracle[^G]*$"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
|
||||
# Get swift object storage name for Service Gateway
|
||||
data "oci_core_services" "svcgtw_services" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = [".*Object.*Storage"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
// VCN is /16, each tier will get /22
|
||||
db_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 0)}"
|
||||
mid_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 1)}"
|
||||
pres_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 2)}"
|
||||
lb_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 3)}"
|
||||
admin_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 4)}"
|
||||
bast_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 5)}"
|
||||
}
|
||||
|
||||
|
||||
module "create_vcn" {
|
||||
source = "./network/vcn"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
vcn_cidr = "${var.vcn_cidr}"
|
||||
vcn_dns_label = "${var.vcn_dns_label}"
|
||||
lbaas_es_port = "${var.lbaas_es_port}"
|
||||
lbaas_standalone_html = "${var.lbaas_standalone_html}"
|
||||
lbaas_html = "${var.lbaas_html}"
|
||||
lbaas_ais = "${var.lbaas_ais}"
|
||||
standalone_jas_pd = "${var.standalone_jas_pd}"
|
||||
jas_pd = "${var.jas_pd}"
|
||||
ais_pd = "${var.ais_pd}"
|
||||
web_nonpd = "${var.web_nonpd }"
|
||||
}
|
||||
|
||||
module "db_subnet" {
|
||||
source = "./network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcn_id}"
|
||||
dns_label = "dbsubad"
|
||||
security_list_ids = "${module.create_vcn.dbslid}"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
module "bas_subnet" {
|
||||
source = "./network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcn_id}"
|
||||
dns_label = "bassubad"
|
||||
security_list_ids = "${module.create_vcn.pubslid}"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PublicRT.id}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.bast_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.bast_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.bast_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
private_subnet = "False"
|
||||
}
|
||||
|
||||
module "mid_subnet" {
|
||||
source = "./network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcn_id}"
|
||||
dns_label = "midsubad"
|
||||
security_list_ids = "${module.create_vcn.midslid}"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.mid_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.mid_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.mid_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
private_subnet = "True"
|
||||
}
|
||||
module "psnt_subnet" {
|
||||
source = "./network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcn_id}"
|
||||
dns_label = "psntsubad"
|
||||
security_list_ids = "${module.create_vcn.psntslid}"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.pres_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.pres_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.pres_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
module "lb_subnet" {
|
||||
source = "./network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcn_id}"
|
||||
dns_label = "lbsubad"
|
||||
security_list_ids = "${module.create_vcn.lbslid}"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
module "admin_subnet" {
|
||||
source = "./network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = ["${var.AD[0]}"]
|
||||
availability_domain = ["${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[0] - 1], "name")}"]
|
||||
vcn_id = "${module.create_vcn.vcn_id}"
|
||||
dns_label = "adminsubad"
|
||||
security_list_ids = "${module.create_vcn.admslid}"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.admin_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.admin_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.admin_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
module "create_bastion" {
|
||||
source = "./bastion"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
bastion_hostname_prefix = "${var.env_prefix}bas${substr(var.region, 3, 3)}"
|
||||
bastion_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
bastion_instance_shape = "${var.bastion_instance_shape}"
|
||||
bastion_subnet = ["${module.bas_subnet.subnet_ids}"]
|
||||
bastion_ssh_public_key = "${var.bastion_ssh_public_key}"
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "vcn_id" {
|
||||
value = "${module.create_vcn.vcn_id}"
|
||||
}
|
||||
output "bastion_public_ip" {
|
||||
value = ["${module.create_bastion.Bastion_Public_IPs}"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
output "bassubid" {
|
||||
value = ["${module.bas_subnet.subnet_ids}"]
|
||||
}
|
||||
|
||||
output "psntsubid" {
|
||||
value = ["${module.psnt_subnet.subnet_ids}"]
|
||||
}
|
||||
|
||||
output "midsubid" {
|
||||
value = ["${module.mid_subnet.subnet_ids}"]
|
||||
}
|
||||
|
||||
output "dbsubid" {
|
||||
value = ["${module.db_subnet.subnet_ids}"]
|
||||
}
|
||||
|
||||
output "adminsubid" {
|
||||
value = ["${module.admin_subnet.subnet_ids}"]
|
||||
}
|
||||
|
||||
output "lbsubid" {
|
||||
value = ["${module.lb_subnet.subnet_ids}"]
|
||||
}
|
||||
|
||||
output "bassubname" {
|
||||
value = ["${module.bas_subnet.subnet_names}"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
output "adminsubname" {
|
||||
value = ["${module.admin_subnet.subnet_names}"]
|
||||
}
|
||||
|
||||
output "psntsubname" {
|
||||
value = ["${module.psnt_subnet.subnet_names}"]
|
||||
}
|
||||
|
||||
output "midsubname" {
|
||||
value = ["${module.mid_subnet.subnet_names}"]
|
||||
}
|
||||
|
||||
output "dbsubname" {
|
||||
value = ["${module.db_subnet.subnet_names}"]
|
||||
}
|
||||
|
||||
output "lbsubname" {
|
||||
value = ["${module.lb_subnet.subnet_names}"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
# Terraform version
|
||||
|
||||
terraform {
|
||||
required_version = ">= 0.11.8"
|
||||
}
|
||||
|
||||
# Oracle Cloud Infrastructure (OCI) Provider
|
||||
|
||||
provider "oci" {
|
||||
version = "=3.5.0"
|
||||
tenancy_ocid = "${var.tenancy_ocid}"
|
||||
user_ocid = "${var.user_ocid}"
|
||||
fingerprint = "${var.fingerprint}"
|
||||
private_key_path = "${var.private_key_path}"
|
||||
region = "${var.region}"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
locals {
|
||||
anywhere = "0.0.0.0/0"
|
||||
}
|
||||
|
||||
# Public Route Table
|
||||
resource "oci_core_route_table" "PublicRT" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = module.create_vcn.vcn_id
|
||||
display_name = "${var.vcn_dns_label}pubrt"
|
||||
|
||||
route_rules {
|
||||
destination = local.anywhere
|
||||
network_entity_id = module.create_vcn.igw_id
|
||||
}
|
||||
}
|
||||
|
||||
# Private Route Table
|
||||
resource "oci_core_route_table" "PrivateRT" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = module.create_vcn.vcn_id
|
||||
display_name = "${var.vcn_dns_label}pvtrt"
|
||||
|
||||
route_rules {
|
||||
destination = lookup(data.oci_core_services.svcgtw_services.services[0], "cidr_block")
|
||||
destination_type = "SERVICE_CIDR_BLOCK"
|
||||
network_entity_id = module.create_vcn.svcgtw_id
|
||||
}
|
||||
route_rules {
|
||||
destination = local.anywhere
|
||||
destination_type = "CIDR_BLOCK"
|
||||
network_entity_id = module.create_vcn.natgtw_id
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "tenancy_ocid" {}
|
||||
variable "user_ocid" {}
|
||||
variable "fingerprint" {}
|
||||
variable "region" {}
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
variable "private_key_path" {}
|
||||
|
||||
variable "ssh_public_key" {}
|
||||
variable "ssh_private_key" {}
|
||||
variable "AD" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
|
||||
# VCN variables
|
||||
variable "vcn_cidr" {
|
||||
description = "CIDR for Virtual Cloud Network (VCN)"
|
||||
}
|
||||
|
||||
variable "vcn_dns_label" {
|
||||
description = "DNS label for Virtual Cloud Network (VCN)"
|
||||
}
|
||||
|
||||
variable "lbaas_es_port" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "lbaas_standalone_html" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "lbaas_html" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "lbaas_ais" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "standalone_jas_pd" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "jas_pd" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "ais_pd" {
|
||||
type = "list"
|
||||
}
|
||||
variable "web_nonpd" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "InstanceOS" {
|
||||
description = "Operating system for compute instances"
|
||||
default = "Oracle Linux"
|
||||
}
|
||||
|
||||
variable "linux_os_version" {
|
||||
description = "Operating system version for all compute instances except NAT"
|
||||
default = "7.5"
|
||||
}
|
||||
|
||||
variable "bastion_instance_shape" {
|
||||
description = "Instance shape of bastion host"
|
||||
default = "VM.Standard2.1"
|
||||
}
|
||||
|
||||
variable "bastion_ssh_public_key" {}
|
||||
|
||||
variable "env_prefix" {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
output "subnet_ids" {
|
||||
value = ["${oci_core_subnet.subnet.*.id}"]
|
||||
}
|
||||
|
||||
output "subnet_names" {
|
||||
value = ["${oci_core_subnet.subnet.*.subnet_domain_name}"]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_subnet" "subnet" {
|
||||
count = "${length(var.availability_domain)}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
cidr_block = "${var.vcn_subnet_cidr[count.index]}"
|
||||
display_name = "${var.dns_label}${var.AD[count.index]}"
|
||||
dns_label = "${var.dns_label}${var.AD[count.index]}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
vcn_id = "${var.vcn_id}"
|
||||
route_table_id = "${var.route_table_id}"
|
||||
security_list_ids = ["${var.security_list_ids}"]
|
||||
prohibit_public_ip_on_vnic = "${var.private_subnet}"
|
||||
dhcp_options_id = "${var.dhcp_options_id}"
|
||||
lifecycle {
|
||||
ignore_changes = ["availability_domain"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
|
||||
|
||||
variable "vcn_id" {}
|
||||
|
||||
variable "route_table_id" {}
|
||||
|
||||
variable "availability_domain" {
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
|
||||
variable "AD" {
|
||||
type = "list"
|
||||
}
|
||||
variable "dhcp_options_id" {}
|
||||
|
||||
variable "vcn_subnet_cidr" {
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
variable "security_list_ids" {}
|
||||
|
||||
variable "dns_label" {}
|
||||
|
||||
variable "private_subnet" {}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
data "oci_core_services" "svcgtw_services" {
|
||||
filter {
|
||||
name = "name"
|
||||
#values = ["Test-Casper-Service", ".*ObjectStorage"]
|
||||
values = [".*Object.*Storage"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "vcn_id" {
|
||||
description = "ocid of VCN"
|
||||
value = "${oci_core_virtual_network.vcn.id}"
|
||||
}
|
||||
output "default_dhcp_id" {
|
||||
description = "ocid of default DHCP options"
|
||||
value = "${oci_core_virtual_network.vcn.default_dhcp_options_id}"
|
||||
}
|
||||
|
||||
output "igw_id" {
|
||||
description = "ocid of internet gateway"
|
||||
value = "${oci_core_internet_gateway.igw.id}"
|
||||
}
|
||||
|
||||
output "natgtw_id" {
|
||||
description = "ocid of service gateway"
|
||||
value = "${oci_core_nat_gateway.natgtw.id}"
|
||||
}
|
||||
output "svcgtw_id" {
|
||||
description = "ocid of service gateway"
|
||||
value = "${oci_core_service_gateway.svcgtw.id}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
output "pubslid" {
|
||||
value = "${oci_core_security_list.publicsl.id}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
output "dbslid" {
|
||||
value = "${oci_core_security_list.dbsl.id}"
|
||||
}
|
||||
|
||||
output "psntslid" {
|
||||
value = "${oci_core_security_list.psntsl.id}"
|
||||
}
|
||||
output "midslid" {
|
||||
value = "${oci_core_security_list.middlesl.id}"
|
||||
}
|
||||
|
||||
output "admslid" {
|
||||
value = "${oci_core_security_list.adminsl.id}"
|
||||
}
|
||||
|
||||
output "lbslid" {
|
||||
value = "${oci_core_security_list.lbsl.id}"
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
tcp_protocol = "6"
|
||||
all_protocols = "all"
|
||||
anywhere = "0.0.0.0/0"
|
||||
db_port = "1521"
|
||||
ssh_port = "22"
|
||||
}
|
||||
resource "oci_core_security_list" "publicsl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "PublicSeclist"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
|
||||
egress_security_rules = [{
|
||||
destination = "0.0.0.0/0"
|
||||
protocol = "all"
|
||||
}]
|
||||
|
||||
ingress_security_rules = [{
|
||||
protocol = "6"
|
||||
source = "0.0.0.0/0"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 22
|
||||
"min" = 22
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "0.0.0.0/0"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 3389
|
||||
"min" = 3389
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "all"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "lbsl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "LBSeclist"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
|
||||
egress_security_rules = [{
|
||||
destination = "0.0.0.0/0"
|
||||
protocol = "all"
|
||||
}]
|
||||
|
||||
ingress_security_rules = [{
|
||||
protocol = "6"
|
||||
source = "0.0.0.0/0"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 6022
|
||||
"min" = 6017
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "all"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_standalone_html}"
|
||||
"min" = "${var.lbaas_standalone_html}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_html}"
|
||||
"min" = "${var.lbaas_html}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_es_port[1]}"
|
||||
"min" = "${var.lbaas_es_port[0]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_ais}"
|
||||
"min" = "${var.lbaas_ais}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 3
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 5
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "dbsl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "DBSeclist"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
|
||||
egress_security_rules = [{
|
||||
destination = "0.0.0.0/0"
|
||||
protocol = "all"
|
||||
}]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
protocol = "6"
|
||||
source = "0.0.0.0/0"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 22
|
||||
"min" = 22
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 8998
|
||||
"min" = 8998
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 14510
|
||||
"min" = 14501
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 1521
|
||||
"min" = 1521
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 5150
|
||||
"min" = 5150
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 3
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 5
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "psntsl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "Presseclist"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
|
||||
egress_security_rules = [{
|
||||
destination = "0.0.0.0/0"
|
||||
protocol = "all"
|
||||
}]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 22
|
||||
"min" = 22
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 8998
|
||||
"min" = 8998
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 14520
|
||||
"min" = 14501
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 5150
|
||||
"min" = 5150
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_standalone_html}"
|
||||
"min" = "${var.lbaas_standalone_html}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_html}"
|
||||
"min" = "${var.lbaas_html}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.lbaas_ais}"
|
||||
"min" = "${var.lbaas_ais}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.standalone_jas_pd[1]}"
|
||||
"min" = "${var.standalone_jas_pd[0]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.jas_pd[1]}"
|
||||
"min" = "${var.jas_pd[0]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.ais_pd[1]}"
|
||||
"min" = "${var.ais_pd[0]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = "${var.web_nonpd[1]}"
|
||||
"min" = "${var.web_nonpd[0]}"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 6022
|
||||
"min" = 6017
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 7001
|
||||
"min" = 7001
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 3
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 5
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "middlesl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "MidSeclist"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
|
||||
egress_security_rules = [{
|
||||
destination = "0.0.0.0/0"
|
||||
protocol = "all"
|
||||
}]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 22
|
||||
"min" = 22
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 8998
|
||||
"min" = 8998
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 14510
|
||||
"min" = 14501
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 6022
|
||||
"min" = 6017
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 5150
|
||||
"min" = 5150
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 3
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 5
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "adminsl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "Adminseclist"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
|
||||
egress_security_rules = [{
|
||||
destination = "0.0.0.0/0"
|
||||
protocol = "all"
|
||||
}]
|
||||
|
||||
ingress_security_rules = [
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 22
|
||||
"min" = 22
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 8999
|
||||
"min" = 8998
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 14510
|
||||
"min" = 14501
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 6022
|
||||
"min" = 6017
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 3000
|
||||
"min" = 3000
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 5150
|
||||
"min" = 5150
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 7001
|
||||
"min" = 7001
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 3389
|
||||
"min" = 3389
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 5985
|
||||
"min" = 5985
|
||||
}
|
||||
},
|
||||
/*
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 339
|
||||
"min" = 339
|
||||
}
|
||||
},
|
||||
*/
|
||||
{
|
||||
protocol = "6"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
tcp_options = {
|
||||
"max" = 445
|
||||
"min" = 445
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 3
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol = "1"
|
||||
source = "${var.vcn_cidr}"
|
||||
|
||||
icmp_options = {
|
||||
"type" = 5
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "NatSecList" {
|
||||
compartment_id = var.compartment_ocid
|
||||
display_name = "NatSecList"
|
||||
vcn_id = oci_core_virtual_network.vcn.id
|
||||
egress_security_rules = [{
|
||||
protocol = "${local.all_protocols}"
|
||||
destination = "${local.anywhere}"
|
||||
}]
|
||||
ingress_security_rules = [{
|
||||
tcp_options = {
|
||||
"max" = "${local.ssh_port}"
|
||||
"min" = "${local.ssh_port}"
|
||||
}
|
||||
protocol = "${local.tcp_protocol}"
|
||||
source = "${var.vcn_cidr}"
|
||||
},
|
||||
{
|
||||
protocol = "all"
|
||||
source = "${var.vcn_cidr}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Virtual Cloud Network (VCN)
|
||||
resource "oci_core_virtual_network" "vcn" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
cidr_block = "${var.vcn_cidr}"
|
||||
dns_label = "${var.vcn_dns_label}"
|
||||
display_name = "${var.vcn_dns_label}"
|
||||
}
|
||||
|
||||
|
||||
# Internet Gateway
|
||||
resource "oci_core_internet_gateway" "igw" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}igw"
|
||||
}
|
||||
|
||||
# NAT (Network Address Translation) Gateway
|
||||
resource "oci_core_nat_gateway" "natgtw" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}natgtw"
|
||||
}
|
||||
|
||||
|
||||
# Service Gateway
|
||||
resource "oci_core_service_gateway" "svcgtw" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
|
||||
services {
|
||||
service_id = "${lookup(data.oci_core_services.svcgtw_services.services[0], "id")}"
|
||||
}
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}svcgtw"
|
||||
}
|
||||
|
||||
# Dynamic Routing Gateway (DRG)
|
||||
resource "oci_core_drg" "drg" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
display_name = "${var.vcn_dns_label}drg"
|
||||
}
|
||||
resource "oci_core_drg_attachment" "drg_attachment" {
|
||||
drg_id = "${oci_core_drg.drg.id}"
|
||||
vcn_id = "${oci_core_virtual_network.vcn.id}"
|
||||
display_name = "${var.vcn_dns_label}drgattchmt"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
# VCN Variables
|
||||
variable "vcn_cidr" {}
|
||||
|
||||
variable "vcn_dns_label" {}
|
||||
|
||||
variable "lbaas_es_port" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "lbaas_standalone_html" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "lbaas_html" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "lbaas_ais" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "standalone_jas_pd" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "jas_pd" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "ais_pd" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "web_nonpd" {
|
||||
type = "list"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_volume" "app_block" {
|
||||
#count = "${var.app_instance_count}"
|
||||
count = "${var.app_block_size != 0 ? var.app_instance_count : 0}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
display_name = "${var.app_hostname_prefix}vol${count.index+1}"
|
||||
size_in_gbs = "${var.app_block_size}"
|
||||
}
|
||||
|
||||
resource "oci_core_volume_attachment" "app_block_attach" {
|
||||
attachment_type = "iscsi"
|
||||
#count = "${var.app_instance_count}"
|
||||
count = "${var.app_block_size != 0 ? var.app_instance_count : 0}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
instance_id = "${element(oci_core_instance.jdeapp.*.id, count.index)}"
|
||||
volume_id = "${element(oci_core_volume.app_block.*.id, count.index)}"
|
||||
|
||||
provisioner "remote-exec" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "30m"
|
||||
host = "${element(oci_core_instance.jdeapp.*.private_ip, count.index)}"
|
||||
user = "opc"
|
||||
private_key = "${file(var.app_ssh_private_key)}"
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_port = "22"
|
||||
bastion_user = "opc"
|
||||
bastion_private_key = "${file(var.bastion_ssh_private_key)}"
|
||||
}
|
||||
|
||||
inline = [
|
||||
"sudo mkdir /u01",
|
||||
"sudo service iscsi reload",
|
||||
"sudo -s bash -c 'iscsiadm -m node -o new -T ${self.iqn} -p ${self.ipv4}:${self.port}'",
|
||||
"sudo -s bash -c 'iscsiadm -m node -o update -T ${self.iqn} -n node.startup -v automatic '",
|
||||
"sudo -s bash -c 'iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -l '",
|
||||
"sudo -s bash -c 'mkfs.ext4 -F /dev/sdb'",
|
||||
"sudo -s bash -c 'mount -t ext4 /dev/sdb /u01'",
|
||||
"sudo -s bash -c 'echo \"/dev/sdb /u01 ext4 defaults,noatime,_netdev,nofail 0 2\" >> /etc/fstab'",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "null_resource" "remote-exec" {
|
||||
count = "${var.app_instance_count}"
|
||||
|
||||
depends_on = ["oci_core_instance.jdeapp",
|
||||
"oci_core_volume.app_block",
|
||||
"oci_core_volume_attachment.app_block_attach",
|
||||
]
|
||||
provisioner "remote-exec" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "30m"
|
||||
host = "${oci_core_instance.jdeapp.*.private_ip[count.index % var.app_instance_count]}"
|
||||
user = "opc"
|
||||
private_key = "${file(var.app_ssh_private_key)}"
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_port = "22"
|
||||
bastion_user = "opc"
|
||||
bastion_private_key = "${file(var.bastion_ssh_private_key)}"
|
||||
}
|
||||
|
||||
inline = [
|
||||
"sudo mkdir -p /u01/jde_tf/${var.init_dir_name}",
|
||||
"sudo chmod -R 777 /u01/jde_tf/${var.init_dir_name}",
|
||||
]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "30m"
|
||||
host = "${oci_core_instance.jdeapp.*.private_ip[count.index % var.app_instance_count]}"
|
||||
user = "opc"
|
||||
private_key = "${file(var.app_ssh_private_key)}"
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_port = "22"
|
||||
bastion_user = "opc"
|
||||
bastion_private_key = "${file(var.bastion_ssh_private_key)}"
|
||||
}
|
||||
|
||||
source = "../modules/userdata/${var.init_dir_name}/"
|
||||
destination = "/u01/jde_tf/${var.init_dir_name}"
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "30m"
|
||||
host = "${oci_core_instance.jdeapp.*.private_ip[count.index % var.app_instance_count]}"
|
||||
user = "opc"
|
||||
private_key = "${file(var.app_ssh_private_key)}"
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_port = "22"
|
||||
bastion_user = "opc"
|
||||
bastion_private_key = "${file(var.bastion_ssh_private_key)}"
|
||||
}
|
||||
|
||||
inline = [
|
||||
"sudo chmod -R 755 /u01/jde_tf/${var.init_dir_name}",
|
||||
"sudo setenforce 0",
|
||||
"sudo cd /u01/jde_tf/${var.init_dir_name}",
|
||||
"if [ -f /u01/jde_tf/${var.init_dir_name}/JDE_OCProv_*.tgz ]; then sudo tar -xvf /u01/jde_tf/${var.init_dir_name}/JDE_OCProv_*.tgz --directory /u01/; fi",
|
||||
"sudo chmod 770 /u01",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "PrvIPs" {
|
||||
value = ["${oci_core_instance.jdeapp.*.private_ip}"]
|
||||
}
|
||||
|
||||
output "HostNames" {
|
||||
value = ["${oci_core_instance.jdeapp.*.display_name}"]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "jdeapp" {
|
||||
count = "${var.app_instance_count}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
display_name = "${var.app_hostname_prefix}${count.index+1}"
|
||||
shape = "${var.app_instance_shape}"
|
||||
fault_domain = "${element(var.fault_domain, count.index)}"
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = "${element(var.app_subnet, count.index)}"
|
||||
display_name = "${var.app_hostname_prefix}${count.index+1}"
|
||||
assign_public_ip = false
|
||||
hostname_label = "${var.app_hostname_prefix}${count.index+1}"
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = "${var.app_image}"
|
||||
}
|
||||
|
||||
metadata {
|
||||
ssh_authorized_keys = "${file(var.app_ssh_public_key)}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
|
||||
variable "app_instance_count" {}
|
||||
|
||||
variable "app_instance_shape" {}
|
||||
|
||||
variable "app_hostname_prefix" {
|
||||
description = "Host name"
|
||||
}
|
||||
|
||||
variable "app_image" {
|
||||
description = "OS Image"
|
||||
}
|
||||
|
||||
variable "app_ssh_private_key" {
|
||||
description = "SSH key"
|
||||
}
|
||||
|
||||
variable "app_ssh_public_key" {
|
||||
description = "SSH key"
|
||||
}
|
||||
|
||||
variable "app_subnet" {
|
||||
type = "list"
|
||||
description = "subnet"
|
||||
}
|
||||
|
||||
variable "availability_domain" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "fault_domain" {
|
||||
description = "Fault Domain"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "AD" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "bastion_public_ip" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "bastion_ssh_private_key" {}
|
||||
|
||||
variable "app_block_size" {}
|
||||
|
||||
variable "unix_mount_directory" {}
|
||||
|
||||
variable "init_dir_name" {}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_database_db_system" "jdedb" {
|
||||
count = var.db_count
|
||||
compartment_id = var.compartment_ocid
|
||||
availability_domain = element(var.availability_domain, count.index)
|
||||
#cpu_core_count = "${lookup(data.oci_database_db_system_shapes.db_system_shapes.db_system_shapes[0], "minimum_core_count")}"
|
||||
database_edition = var.db_edition
|
||||
|
||||
db_home {
|
||||
database = {
|
||||
"admin_password" = "${var.db_admin_password}"
|
||||
"db_name" = "${var.db_name}"
|
||||
"character_set" = "${var.db_characterset}"
|
||||
"ncharacter_set" = "${var.db_nls_characterset}"
|
||||
"db_workload" = "${var.db_workload}"
|
||||
"pdb_name" = "${var.db_pdb_name}"
|
||||
}
|
||||
db_version = var.db_version
|
||||
display_name = var.db_name
|
||||
}
|
||||
shape = var.db_instance_shape
|
||||
node_count = var.db_node_count
|
||||
data_storage_size_in_gb = var.db_size_in_gb
|
||||
license_model = var.db_license_model
|
||||
disk_redundancy = var.db_disk_redundancy
|
||||
subnet_id = element(var.db_subnet, count.index)
|
||||
ssh_public_keys = ["${trimspace(file("${var.db_ssh_public_key}"))}"]
|
||||
display_name = "${var.db_hostname_prefix}${count.index + 1}"
|
||||
hostname = "${var.db_hostname_prefix}${count.index + 1}"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "DBNodeHostname" {
|
||||
value = ["${oci_database_db_system.jdedb.*.display_name}"]
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
variable "db_subnet" {
|
||||
type="list"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
# DBSystem specific
|
||||
#variable "db_cpucorecount" {}
|
||||
|
||||
variable "db_edition" {}
|
||||
|
||||
variable "db_admin_password" {}
|
||||
|
||||
variable "db_name" {}
|
||||
|
||||
variable "db_version" {}
|
||||
|
||||
variable "db_disk_redundancy" {
|
||||
description = "Database disk redundancy for Bare Metal DB System"
|
||||
default="NORMAL"
|
||||
}
|
||||
|
||||
variable "db_hostname_prefix" {}
|
||||
variable "db_instance_shape" {}
|
||||
|
||||
variable "db_ssh_public_key" {}
|
||||
|
||||
variable "db_ssh_private_key" {}
|
||||
|
||||
variable "db_count" {}
|
||||
|
||||
variable "db_nls_characterset" {
|
||||
default = "AL16UTF16"
|
||||
}
|
||||
|
||||
variable "db_characterset" {
|
||||
default = "AL32UTF8"
|
||||
}
|
||||
|
||||
variable "db_workload" {
|
||||
default = "OLTP"
|
||||
}
|
||||
|
||||
variable "db_pdb_name" {
|
||||
default = "pdbName"
|
||||
}
|
||||
|
||||
variable "db_size_in_gb" {
|
||||
default = "256"
|
||||
}
|
||||
|
||||
variable "db_license_model" {
|
||||
default = "LICENSE_INCLUDED"
|
||||
}
|
||||
|
||||
variable "db_node_count" {
|
||||
default = "1"
|
||||
}
|
||||
variable "init_dir_name" {}
|
||||
|
||||
variable "bastion_public_ip" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "bastion_ssh_private_key" {}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
data "oci_dns_zones" "zs" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
name = "${var.dns_server_zone_name}"
|
||||
#name_contains = "${var.dns_server_zone_name}"
|
||||
state = "ACTIVE"
|
||||
sort_by = "name" # name|zoneType|timeCreated
|
||||
sort_order = "DESC" # ASC|DESC
|
||||
}
|
||||
|
||||
data "oci_dns_records" "rs" {
|
||||
zone_name_or_id = "${oci_dns_zone.jde_zone.name}"
|
||||
|
||||
# optional
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
domain = "${var.dns_server_zone_name}"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_dns_zone" "jde_zone" {
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
name = "${var.dns_server_zone_name}"
|
||||
zone_type = "PRIMARY"
|
||||
}
|
||||
|
||||
resource "oci_dns_record" "batch_alias" {
|
||||
count = "2"
|
||||
zone_name_or_id = "${oci_dns_zone.jde_zone.name}"
|
||||
domain = "${var.batch_alias}.${oci_dns_zone.jde_zone.name}"
|
||||
rtype = "A"
|
||||
rdata = "${element(flatten(var.batch_rdata), count.index)}"
|
||||
ttl = 300
|
||||
}
|
||||
|
||||
resource "oci_dns_record" "logic_alias" {
|
||||
count = "2"
|
||||
zone_name_or_id = "${oci_dns_zone.jde_zone.name}"
|
||||
domain = "${var.logic_alias}.${oci_dns_zone.jde_zone.name}"
|
||||
rtype = "A"
|
||||
rdata = "${element(flatten(var.logic_rdata), count.index)}"
|
||||
ttl = 300
|
||||
}
|
||||
|
||||
resource "oci_dns_record" "web_alias" {
|
||||
count = "2"
|
||||
zone_name_or_id = "${var.dns_server_zone_name}"
|
||||
domain = "${var.web_alias}.${oci_dns_zone.jde_zone.name}"
|
||||
rtype = "A"
|
||||
rdata = "${element(flatten(var.web_rdata), count.index)}"
|
||||
ttl = 300
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "zones" {
|
||||
value = "${data.oci_dns_zones.zs.zones}"
|
||||
}
|
||||
|
||||
output "records" {
|
||||
value = "${data.oci_dns_records.rs.records}"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
}
|
||||
|
||||
variable "dns_server_zone_name" {
|
||||
}
|
||||
|
||||
variable "batch_alias" {
|
||||
default = "batch"
|
||||
}
|
||||
|
||||
variable "logic_alias" {
|
||||
default = "logic"
|
||||
}
|
||||
|
||||
variable "web_alias" {
|
||||
default = "web"
|
||||
}
|
||||
|
||||
variable "batch_rdata" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "logic_rdata" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "web_rdata" {
|
||||
type = "list"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "lb_private_ip" {
|
||||
value = ["${oci_load_balancer.lb.*.ip_addresses}"]
|
||||
}
|
||||
output "lb_id" {
|
||||
value = ["${oci_load_balancer.lb.*.id}"]
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
|
||||
/* Load Balancer */
|
||||
resource "oci_load_balancer" "lb" {
|
||||
shape = "100Mbps"
|
||||
count = "${length(var.load_balancer_subnet)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
subnet_ids = ["${element(var.load_balancer_subnet, count.index)}"]
|
||||
display_name = "${var.load_balancer_name}${count.index+1}"
|
||||
is_private = "True"
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend_set" "lb1-bes" {
|
||||
count = "${length(var.load_balancer_listen_port)}"
|
||||
name = "lb1-bes${count.index + 1}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, 0)}"
|
||||
policy = "ROUND_ROBIN"
|
||||
|
||||
health_checker {
|
||||
port = "0"
|
||||
protocol = "TCP"
|
||||
response_body_regex = ".*"
|
||||
}
|
||||
session_persistence_configuration {
|
||||
cookie_name = "*"
|
||||
#disable_fallback = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend_set" "lb2-bes" {
|
||||
count = "${length(var.load_balancer_listen_port)}"
|
||||
name = "lb2-bes${count.index + 1}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, 1)}"
|
||||
policy = "ROUND_ROBIN"
|
||||
|
||||
health_checker {
|
||||
port = "0"
|
||||
protocol = "TCP"
|
||||
response_body_regex = ".*"
|
||||
}
|
||||
session_persistence_configuration {
|
||||
cookie_name = "*"
|
||||
#disable_fallback = true
|
||||
}
|
||||
}
|
||||
|
||||
# Backends for LB 1.
|
||||
resource "oci_load_balancer_backend" "lb1-be" {
|
||||
count = "${var.app_instance_count * length(var.load_balancer_listen_port)}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, 0)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb1-bes.*.name, count.index % length(var.load_balancer_listen_port))}"
|
||||
ip_address = "${element(var.be1_ip_address1, count.index / length(var.load_balancer_listen_port))}"
|
||||
port = "${element(var.load_balancer_listen_port, count.index % length(var.load_balancer_listen_port))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
# Backends for LB 2
|
||||
resource "oci_load_balancer_backend" "lb2-be" {
|
||||
count = "${var.app_instance_count * length(var.load_balancer_listen_port)}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, 1)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb2-bes.*.name, count.index % length(var.load_balancer_listen_port))}"
|
||||
ip_address = "${element(var.be1_ip_address1, count.index / length(var.load_balancer_listen_port))}"
|
||||
port = "${element(var.load_balancer_listen_port, count.index % length(var.load_balancer_listen_port))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb-listener1" {
|
||||
count = "${length(var.load_balancer_listen_port)}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, 0)}"
|
||||
name = "${var.load_balancer_name}-lsnr${count.index + 1}"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb1-bes.*.name, count.index)}"
|
||||
port = "${element(var.load_balancer_listen_port, count.index)}"
|
||||
protocol = "${var.load_balancer_protocol}"
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "300"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb-listener2" {
|
||||
count = "${length(var.load_balancer_listen_port)}"
|
||||
load_balancer_id = "${element(oci_load_balancer.lb.*.id, 1)}"
|
||||
name = "${var.load_balancer_name}-lsnr${count.index + 1}"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb2-bes.*.name, count.index)}"
|
||||
port = "${element(var.load_balancer_listen_port, count.index)}"
|
||||
protocol = "${var.load_balancer_protocol}"
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "300"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
variable "be1_ip_address1" {
|
||||
type="list"
|
||||
}
|
||||
|
||||
variable "app_instance_count" {}
|
||||
|
||||
variable "load_balancer_count" {}
|
||||
|
||||
variable "load_balancer_private" {
|
||||
default = "True"
|
||||
}
|
||||
|
||||
variable "load_balancer_name" {
|
||||
}
|
||||
|
||||
variable "load_balancer_shape" {
|
||||
default = "100Mbps"
|
||||
}
|
||||
|
||||
variable "load_balancer_protocol" {}
|
||||
|
||||
variable "load_balancer_subnet" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "load_balancer_listen_port" {
|
||||
type = "list"
|
||||
default= ["6017", "6018", "6019", "6020", "6021", "6022"]
|
||||
}
|
||||
|
||||
variable "app_instance_listen_port" {
|
||||
type = "list"
|
||||
default= ["6017", "6018", "6019", "6020", "6021", "6022"]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
output "PrvIPs" {
|
||||
value = ["${oci_core_instance.jdeapp.*.private_ip}"]
|
||||
}
|
||||
|
||||
output "HostNames" {
|
||||
value = ["${oci_core_instance.jdeapp.*.display_name}"]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "jdeapp" {
|
||||
count = "${var.app_instance_count}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
display_name = "${var.app_hostname_prefix}${count.index+1}"
|
||||
shape = "${var.app_instance_shape}"
|
||||
fault_domain = "${element(var.fault_domain, count.index)}"
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = "${element(var.app_subnet, count.index)}"
|
||||
display_name = "${var.app_hostname_prefix}${count.index+1}"
|
||||
assign_public_ip = false
|
||||
hostname_label = "${var.app_hostname_prefix}${count.index+1}"
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = "${var.app_image}"
|
||||
}
|
||||
|
||||
metadata {}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
|
||||
variable "app_instance_count" {}
|
||||
|
||||
variable "app_instance_shape" {}
|
||||
|
||||
variable "app_hostname_prefix" {
|
||||
description = "Host name"
|
||||
}
|
||||
|
||||
variable "app_image" {
|
||||
description = "OS Image"
|
||||
}
|
||||
|
||||
variable "app_subnet" {
|
||||
type = "list"
|
||||
description = "subnet"
|
||||
}
|
||||
|
||||
variable "availability_domain" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "fault_domain" {
|
||||
description = "Fault Domain"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "AD" {
|
||||
type = "list"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
# Gets a list of Availability Domains
|
||||
data "oci_identity_availability_domains" "ADs" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
}
|
||||
|
||||
# Gets a list of all Oracle Linux 6.9 images that support a given Instance shape
|
||||
data "oci_core_images" "InstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.InstanceOS}"
|
||||
operating_system_version = "${var.linux_os_version}"
|
||||
filter {
|
||||
name = "display_name"
|
||||
values = ["^.*Oracle[^G]*$"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
|
||||
data "oci_core_images" "WinInstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.WinInstanceOS}"
|
||||
operating_system_version = "${var.WinInstanceOSVersion}"
|
||||
}
|
||||
|
||||
data "template_file" "user_ad" {
|
||||
count = "${length(var.AD)}"
|
||||
template = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[count.index] - 1], "name")}"
|
||||
}
|
||||
|
||||
# Gets name of Fault Domains
|
||||
|
||||
data "oci_identity_fault_domains" "fds" {
|
||||
count = "${length(var.AD)}"
|
||||
availability_domain = "${element(data.template_file.user_ad.*.rendered, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
}
|
||||
|
||||
locals {
|
||||
fds = "${flatten(concat(data.oci_identity_fault_domains.fds.*.fault_domains))}"
|
||||
fd_per_ad = 3
|
||||
}
|
||||
|
||||
data "template_file" "deployment_fd" {
|
||||
template = "$${name}"
|
||||
count = "${length(var.AD) * (local.fd_per_ad) }"
|
||||
vars = {
|
||||
name = "${lookup(local.fds[count.index], "name")}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
module "create_wls" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.user_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.wls_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}wls"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.wls_instance_shape}"
|
||||
app_subnet = ["${var.psntsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "web"
|
||||
app_block_size = "${var.wls_bv_size}"
|
||||
}
|
||||
|
||||
module "create_logic" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.user_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.logic_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}es"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.logic_instance_shape}"
|
||||
app_subnet = ["${var.midsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "ent"
|
||||
app_block_size = "${var.logic_bv_size}"
|
||||
}
|
||||
|
||||
module "create_batch" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.user_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.batch_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}batch"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.batch_instance_shape}"
|
||||
app_subnet = ["${var.midsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "ent"
|
||||
app_block_size = "${var.batch_bv_size}"
|
||||
}
|
||||
|
||||
module "create_sm" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.user_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.sm_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}smc"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.sm_instance_shape}"
|
||||
app_subnet = ["${var.adminsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "sm"
|
||||
app_block_size = "${var.sm_bv_size}"
|
||||
}
|
||||
|
||||
module "create_depsvr" {
|
||||
source = "../modules/win"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.user_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.dep_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}dep"
|
||||
app_image = "${data.oci_core_images.WinInstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.dep_instance_shape}"
|
||||
app_subnet = ["${var.adminsubid}"]
|
||||
}
|
||||
|
||||
# Module to create Database
|
||||
module "create_db" {
|
||||
source = "../modules/db"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
availability_domain = ["${data.template_file.user_ad.*.rendered}"]
|
||||
db_count = "${var.db_count}"
|
||||
#db_cpucorecount = "${var.db_cpucorecount}"
|
||||
db_edition = "${var.db_edition}"
|
||||
db_instance_shape = "${var.db_instance_shape}"
|
||||
db_node_count = "${var.db_node_count}"
|
||||
db_hostname_prefix = "${var.env_prefix}db"
|
||||
db_size_in_gb = "${var.db_size_in_gb}"
|
||||
db_license_model = "${var.db_license_model}"
|
||||
db_subnet = ["${var.dbsubid}"]
|
||||
db_ssh_public_key = "${var.ssh_public_key}"
|
||||
db_admin_password = "${var.db_admin_password}"
|
||||
db_name = "${var.db_name}"
|
||||
db_characterset = "${var.db_characterset}"
|
||||
db_nls_characterset = "${var.db_nls_characterset}"
|
||||
#db_workload = "${var.db_workload}"
|
||||
db_version = "${var.db_version}"
|
||||
#db_disk_redundancy = "${var.db_disk_redundancy}"
|
||||
db_pdb_name = "${var.db_pdb_name}"
|
||||
init_dir_name = "db"
|
||||
db_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "WLShostNames" {
|
||||
value = ["${module.create_wls.HostNames}"]
|
||||
}
|
||||
|
||||
output "WLSPrivateIPs" {
|
||||
value = ["${module.create_wls.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "LogicPrivateIPs" {
|
||||
value = ["${module.create_logic.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "LogichostNames" {
|
||||
value = ["${module.create_logic.HostNames}"]
|
||||
}
|
||||
|
||||
output "BatchPrivateIPs" {
|
||||
value = ["${module.create_batch.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "BatchhostNames" {
|
||||
value = ["${module.create_batch.HostNames}"]
|
||||
}
|
||||
|
||||
output "SMPrivateIPs" {
|
||||
value = ["${module.create_sm.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "SMhostNames" {
|
||||
value = ["${module.create_sm.HostNames}"]
|
||||
}
|
||||
|
||||
output "DepPrivateIP" {
|
||||
value = ["${module.create_depsvr.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "DephostName" {
|
||||
value = ["${module.create_depsvr.HostNames}"]
|
||||
}
|
||||
|
||||
output "DBhostNames" {
|
||||
value = ["${module.create_db.DBNodeHostname}"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
# Terraform version
|
||||
|
||||
terraform {
|
||||
required_version = ">= 0.11.8"
|
||||
}
|
||||
|
||||
# Oracle Cloud Infrastructure (OCI) Provider
|
||||
|
||||
provider "oci" {
|
||||
version = "=3.5.0"
|
||||
tenancy_ocid = "${var.tenancy_ocid}"
|
||||
user_ocid = "${var.user_ocid}"
|
||||
fingerprint = "${var.fingerprint}"
|
||||
private_key_path = "${var.private_key_path}"
|
||||
region = "${var.region}"
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "tenancy_ocid" {}
|
||||
|
||||
variable "region" {}
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
variable "AD" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "user_ocid" {}
|
||||
|
||||
variable "fingerprint" {}
|
||||
|
||||
variable "private_key_path" {}
|
||||
|
||||
variable "ssh_public_key" {}
|
||||
|
||||
variable "ssh_private_key" {}
|
||||
|
||||
variable "bastion_ssh_private_key" {}
|
||||
|
||||
variable "InstanceOS" {
|
||||
description = "Operating system for compute instances"
|
||||
default = "Oracle Linux"
|
||||
}
|
||||
|
||||
variable "linux_os_version" {
|
||||
description = "Operating system version for all compute instances except NAT"
|
||||
default = "7.5"
|
||||
}
|
||||
|
||||
variable "WinInstanceOS" {
|
||||
description = "Operating system for compute instances"
|
||||
default = "Windows"
|
||||
}
|
||||
|
||||
variable "WinInstanceOSVersion" {
|
||||
description = "Operating system version for all compute instances except NAT"
|
||||
default = "Server 2016 Standard"
|
||||
}
|
||||
|
||||
# JDE DB Server Specfic
|
||||
variable "db_count" {}
|
||||
|
||||
#variable "db_cpucorecount" {}
|
||||
|
||||
variable "db_edition" {}
|
||||
|
||||
variable "db_instance_shape" {}
|
||||
|
||||
variable "db_node_count" {}
|
||||
|
||||
|
||||
variable "db_size_in_gb" {
|
||||
default = "256"
|
||||
}
|
||||
|
||||
variable "db_license_model" {}
|
||||
|
||||
variable "db_admin_password" {}
|
||||
|
||||
variable "db_name" {}
|
||||
|
||||
variable "db_characterset" {}
|
||||
|
||||
variable "db_nls_characterset" {}
|
||||
|
||||
variable "db_workload" {
|
||||
default="OLTP"
|
||||
}
|
||||
|
||||
variable "db_version" {}
|
||||
|
||||
variable "db_pdb_name" {}
|
||||
|
||||
variable "db_disk_redundancy" {
|
||||
default="NORMAL"
|
||||
}
|
||||
|
||||
variable "env_prefix" {
|
||||
}
|
||||
|
||||
variable "unix_mount_directory" {
|
||||
default = "//u01"
|
||||
}
|
||||
|
||||
variable "logic_instance_count" {}
|
||||
|
||||
variable "logic_instance_shape" {}
|
||||
|
||||
variable "batch_instance_count" {}
|
||||
|
||||
variable "batch_instance_shape" {}
|
||||
|
||||
variable "wls_instance_count" {}
|
||||
|
||||
variable "wls_instance_shape" {}
|
||||
|
||||
variable "sm_instance_shape" {}
|
||||
|
||||
variable "sm_instance_count" {}
|
||||
|
||||
variable "dep_instance_shape" {}
|
||||
|
||||
variable "dep_instance_count" {}
|
||||
|
||||
variable "psntsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "midsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "adminsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "dbsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "bastion_public_ip" {}
|
||||
|
||||
variable "wls_bv_size" {}
|
||||
|
||||
variable "logic_bv_size" {}
|
||||
|
||||
variable "batch_bv_size" {}
|
||||
|
||||
variable "sm_bv_size" {}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get list of Availability Domains
|
||||
data "oci_identity_availability_domains" "ADs" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
}
|
||||
|
||||
# Get name of Availability Domains
|
||||
data "template_file" "deployment_ad" {
|
||||
count = "${length(var.AD)}"
|
||||
template = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[count.index] - 1], "name")}"
|
||||
}
|
||||
|
||||
# Get list of Fault Domains
|
||||
data "oci_identity_fault_domains" "fds" {
|
||||
count = "${length(var.AD)}"
|
||||
availability_domain = "${element(data.template_file.deployment_ad.*.rendered, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
}
|
||||
|
||||
locals {
|
||||
fds = "${flatten(concat(data.oci_identity_fault_domains.fds.*.fault_domains))}"
|
||||
faultdomains_per_ad = 3
|
||||
}
|
||||
|
||||
# Get name of Fault Domains
|
||||
data "template_file" "deployment_fd" {
|
||||
template = "$${name}"
|
||||
count = "${length(var.AD) * (local.faultdomains_per_ad) }"
|
||||
vars = {
|
||||
name = "${lookup(local.fds[count.index], "name")}"
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Oracle Linux image
|
||||
data "oci_core_images" "InstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.InstanceOS}"
|
||||
operating_system_version = "${var.linux_os_version}"
|
||||
filter {
|
||||
name = "display_name"
|
||||
values = ["^.*Oracle[^G]*$"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Windows image
|
||||
data "oci_core_images" "WinInstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.WinInstanceOS}"
|
||||
operating_system_version = "${var.WinInstanceOSVersion}"
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
module "create_wls" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.wls_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}wls" #"${substr(var.region, 3, 3)}"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.wls_instance_shape}"
|
||||
app_subnet = ["${var.psntsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "web"
|
||||
app_block_size = "${var.wls_bv_size}"
|
||||
}
|
||||
|
||||
module "create_logic" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.logic_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}logic"#"${substr(var.region, 3, 3)}"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.logic_instance_shape}"
|
||||
app_subnet = ["${var.midsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "ent"
|
||||
app_block_size = "${var.logic_bv_size}"
|
||||
}
|
||||
|
||||
module "create_batch" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.batch_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}batch"#"${substr(var.region, 3, 3)}"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.batch_instance_shape}"
|
||||
app_subnet = ["${var.midsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "ent"
|
||||
app_block_size = "${var.batch_bv_size}"
|
||||
}
|
||||
|
||||
module "create_sm" {
|
||||
source = "../modules/app"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.sm_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}smc"#"${substr(var.region, 3, 3)}"
|
||||
app_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.sm_instance_shape}"
|
||||
app_subnet = ["${var.adminsubid}"]
|
||||
app_ssh_public_key = "${var.ssh_public_key}"
|
||||
app_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
unix_mount_directory = "${var.unix_mount_directory}"
|
||||
init_dir_name = "sm"
|
||||
app_block_size = "${var.sm_bv_size}"
|
||||
}
|
||||
|
||||
module "create_depsvr" {
|
||||
source = "../modules/win"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
app_instance_count = "${var.dep_instance_count}"
|
||||
app_hostname_prefix = "${var.env_prefix}dep"#"${substr(var.region, 3, 3)}"
|
||||
app_image = "${data.oci_core_images.WinInstanceImageOCID.images.0.id}"
|
||||
app_instance_shape = "${var.dep_instance_shape}"
|
||||
app_subnet = ["${var.adminsubid}"]
|
||||
}
|
||||
|
||||
# Module to create Database
|
||||
module "create_db" {
|
||||
source = "../modules/db"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
db_count = "${var.db_count}"
|
||||
db_edition = "${var.db_edition}"
|
||||
db_instance_shape = "${var.db_instance_shape}"
|
||||
db_node_count = "${var.db_node_count}"
|
||||
db_hostname_prefix = "${var.env_prefix}db"#"${substr(var.region, 3, 3)}"
|
||||
db_size_in_gb = "${var.db_size_in_gb}"
|
||||
db_license_model = "${var.db_license_model}"
|
||||
db_subnet = ["${var.dbsubid}"]
|
||||
db_ssh_public_key = "${var.ssh_public_key}"
|
||||
db_admin_password = "${var.db_admin_password}"
|
||||
db_name = "${var.db_name}"
|
||||
db_characterset = "${var.db_characterset}"
|
||||
db_nls_characterset = "${var.db_nls_characterset}"
|
||||
#db_workload = "${var.db_workload}"
|
||||
db_version = "${var.db_version}"
|
||||
#db_disk_redundancy = "${var.db_disk_redundancy}"
|
||||
db_pdb_name = "${var.db_pdb_name}"
|
||||
init_dir_name = "db"
|
||||
db_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_public_ip = "${var.bastion_public_ip}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
}
|
||||
|
||||
## Module to create Load Balancer
|
||||
module "create_batch_lb" {
|
||||
source = "../modules/lbaas"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
load_balancer_count = "${var.batch_load_balancer_count}"
|
||||
load_balancer_shape = "${var.load_balancer_shape}"
|
||||
load_balancer_subnet = ["${var.lbsubid}"]
|
||||
load_balancer_name = "${var.env_prefix}batchlb${substr(var.region, 3, 3)}"
|
||||
#load_balancer_hostname = "${var.load_balancer_hostname}"
|
||||
load_balancer_protocol = "TCP"
|
||||
load_balancer_listen_port = "${var.load_balancer_listen_port}"
|
||||
app_instance_listen_port = "${var.app_instance_listen_port}"
|
||||
app_instance_count = "${var.batch_instance_count}"
|
||||
be1_ip_address1 = ["${module.create_batch.PrvIPs}"]
|
||||
}
|
||||
|
||||
module "create_logic_lb" {
|
||||
source = "../modules/lbaas"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
load_balancer_count = "${var.logic_load_balancer_count}"
|
||||
load_balancer_shape = "${var.load_balancer_shape}"
|
||||
load_balancer_subnet = ["${var.lbsubid}"]
|
||||
load_balancer_name = "${var.env_prefix}logiclb${substr(var.region, 3, 3)}"
|
||||
#load_balancer_hostname = "${var.load_balancer_hostname}"
|
||||
load_balancer_listen_port = ["${var.load_balancer_listen_port}"]
|
||||
load_balancer_protocol = "TCP"
|
||||
app_instance_listen_port = ["${var.app_instance_listen_port}"]
|
||||
app_instance_count = "${var.logic_instance_count}"
|
||||
be1_ip_address1 = ["${module.create_logic.PrvIPs}"]
|
||||
}
|
||||
|
||||
#Module to configure DNS entries of LB Private IPs.
|
||||
module "create_dns" {
|
||||
source = "../modules/dns"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
dns_server_zone_name = "${var.dns_server_zone_name}"
|
||||
batch_alias = "${var.load_balancer_batch_alias_name}"
|
||||
logic_alias = "${var.load_balancer_logic_alias_name}"
|
||||
web_alias = "${var.load_balancer_web_alias_name}"
|
||||
batch_rdata = ["${module.create_batch_lb.lb_private_ip}"]
|
||||
logic_rdata = ["${module.create_logic_lb.lb_private_ip}"]
|
||||
web_rdata = ["${module.create_logic_lb.lb_private_ip}"]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "WLShostNames" {
|
||||
value = ["${module.create_wls.HostNames}"]
|
||||
}
|
||||
output "WLSPrivateIPs" {
|
||||
value = ["${module.create_wls.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "LogicPrivateIPs" {
|
||||
value = ["${module.create_logic.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "LogichostNames" {
|
||||
value = ["${module.create_logic.HostNames}"]
|
||||
}
|
||||
|
||||
output "BatchPrivateIPs" {
|
||||
value = ["${module.create_batch.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "BatchhostNames" {
|
||||
value = ["${module.create_batch.HostNames}"]
|
||||
}
|
||||
|
||||
output "SMPrivateIPs" {
|
||||
value = ["${module.create_sm.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "SMhostNames" {
|
||||
value = ["${module.create_sm.HostNames}"]
|
||||
}
|
||||
|
||||
output "DepPrivateIP" {
|
||||
value = ["${module.create_depsvr.PrvIPs}"]
|
||||
}
|
||||
|
||||
output "DephostName" {
|
||||
value = ["${module.create_depsvr.HostNames}"]
|
||||
}
|
||||
|
||||
output "DBhostNames" {
|
||||
value = ["${module.create_db.DBNodeHostname}"]
|
||||
}
|
||||
|
||||
output "LogicLBPrivateIPs" {
|
||||
value = ["${module.create_logic_lb.lb_private_ip}"]
|
||||
}
|
||||
|
||||
output "BatchLBPrivateIPs" {
|
||||
value = ["${module.create_batch_lb.lb_private_ip}"]
|
||||
}
|
||||
|
||||
output "DNS_Zone" {
|
||||
value = "${module.create_dns.zones}"
|
||||
}
|
||||
|
||||
output "DNS_Records" {
|
||||
value = "${module.create_dns.records}"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
# Terraform version
|
||||
|
||||
terraform {
|
||||
required_version = ">= 0.11.8"
|
||||
}
|
||||
|
||||
# Oracle Cloud Infrastructure (OCI) Provider
|
||||
|
||||
provider "oci" {
|
||||
version = "=3.5.0"
|
||||
tenancy_ocid = "${var.tenancy_ocid}"
|
||||
user_ocid = "${var.user_ocid}"
|
||||
fingerprint = "${var.fingerprint}"
|
||||
private_key_path = "${var.private_key_path}"
|
||||
region = "${var.region}"
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "tenancy_ocid" {}
|
||||
|
||||
variable "region" {}
|
||||
|
||||
variable "compartment_ocid" {}
|
||||
|
||||
variable "AD" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "user_ocid" {}
|
||||
|
||||
variable "fingerprint" {}
|
||||
|
||||
variable "private_key_path" {}
|
||||
|
||||
variable "ssh_public_key" {}
|
||||
|
||||
variable "ssh_private_key" {}
|
||||
|
||||
variable "bastion_ssh_private_key" {}
|
||||
|
||||
variable "InstanceOS" {
|
||||
description = "Operating system for compute instances"
|
||||
default = "Oracle Linux"
|
||||
}
|
||||
|
||||
variable "linux_os_version" {
|
||||
description = "Operating system version for all compute instances except NAT"
|
||||
default = "7.5"
|
||||
}
|
||||
|
||||
|
||||
|
||||
variable "WinInstanceOS" {
|
||||
description = "Operating system for compute instances"
|
||||
default = "Windows"
|
||||
}
|
||||
|
||||
variable "WinInstanceOSVersion" {
|
||||
description = "Operating system version for all compute instances except NAT"
|
||||
default = "Server 2016 Standard"
|
||||
}
|
||||
|
||||
# JDE DBS Specfic
|
||||
variable "db_count" {}
|
||||
|
||||
#variable "db_cpucorecount" {}
|
||||
|
||||
variable "db_edition" {}
|
||||
|
||||
variable "db_instance_shape" {}
|
||||
|
||||
variable "db_node_count" {}
|
||||
|
||||
variable "db_size_in_gb" {
|
||||
default = "256"
|
||||
}
|
||||
|
||||
variable "db_license_model" {}
|
||||
|
||||
variable "db_admin_password" {}
|
||||
|
||||
variable "db_name" {}
|
||||
|
||||
variable "db_characterset" {}
|
||||
|
||||
variable "db_nls_characterset" {}
|
||||
|
||||
variable "db_workload" {
|
||||
default = "OLTP"
|
||||
}
|
||||
|
||||
variable "db_version" {}
|
||||
|
||||
variable "db_pdb_name" {}
|
||||
|
||||
#variable "db_disk_redundancy" {}
|
||||
|
||||
#JDE LBaaS Specific
|
||||
variable "logic_load_balancer_count" {
|
||||
default = "2"
|
||||
}
|
||||
|
||||
variable "batch_load_balancer_count" {
|
||||
default = "2"
|
||||
}
|
||||
|
||||
variable "load_balancer_name" {
|
||||
default = "jdelb"
|
||||
}
|
||||
|
||||
variable "load_balancer_shape" {
|
||||
default = "100Mbps"
|
||||
}
|
||||
|
||||
variable "load_balancer_listen_port" {
|
||||
type = "list"
|
||||
default= ["6017", "6018", "6019", "6020", "6021", "6022"]
|
||||
}
|
||||
|
||||
variable "app_instance_listen_port" {
|
||||
type = "list"
|
||||
default= ["6017", "6018", "6019", "6020", "6021", "6022"]
|
||||
}
|
||||
|
||||
variable "lbaas_listen_port_standalone_html"{
|
||||
default = "9001"
|
||||
}
|
||||
|
||||
variable "lbaas_listen_port_html"{
|
||||
default = "9002"
|
||||
}
|
||||
|
||||
variable "lbaas_listen_port_ais"{
|
||||
default = "9003"
|
||||
}
|
||||
|
||||
variable "listen_port_range_standalone_html"{
|
||||
type = "list"
|
||||
default = ["8001", "8004"]
|
||||
}
|
||||
|
||||
variable "listen_port_range_html"{
|
||||
type = "list"
|
||||
default = ["8005", "8088"]
|
||||
}
|
||||
|
||||
variable "listen_port_range_ais"{
|
||||
type = "list"
|
||||
default = ["8010", "8014"]
|
||||
}
|
||||
|
||||
variable "load_balancer_certificate_name" {}
|
||||
|
||||
variable "load_balancer_ca_certificate" {}
|
||||
|
||||
variable "load_balancer_certificate_passphrase" {}
|
||||
|
||||
variable "load_balancer_certificate_private_key" {}
|
||||
|
||||
variable "load_balancer_certificate_public_certificate" {}
|
||||
|
||||
|
||||
variable "env_prefix" {
|
||||
default = "myenv"
|
||||
}
|
||||
|
||||
variable "unix_mount_directory" {
|
||||
default = "//u01"
|
||||
}
|
||||
|
||||
variable "logic_instance_count" {}
|
||||
|
||||
variable "logic_instance_shape" {}
|
||||
|
||||
variable "batch_instance_count" {}
|
||||
|
||||
variable "batch_instance_shape" {}
|
||||
|
||||
variable "wls_instance_count" {}
|
||||
|
||||
variable "wls_instance_shape" {}
|
||||
|
||||
variable "sm_instance_shape" {}
|
||||
|
||||
variable "sm_instance_count" {}
|
||||
|
||||
variable "dep_instance_shape" {}
|
||||
|
||||
variable "dep_instance_count" {}
|
||||
|
||||
variable "psntsubid" {
|
||||
type= "list"
|
||||
}
|
||||
variable "midsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "adminsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "dbsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "lbsubid" {
|
||||
type= "list"
|
||||
}
|
||||
|
||||
variable "bastion_public_ip" {}
|
||||
|
||||
variable "wls_bv_size" {}
|
||||
|
||||
variable "logic_bv_size" {}
|
||||
|
||||
variable "batch_bv_size" {}
|
||||
|
||||
variable "sm_bv_size" {}
|
||||
|
||||
#DNS specific variables
|
||||
variable "dns_server_zone_name" {}
|
||||
|
||||
variable "load_balancer_logic_alias_name" {}
|
||||
|
||||
variable "load_balancer_batch_alias_name" {}
|
||||
|
||||
variable "load_balancer_web_alias_name" {}
|
||||
@@ -0,0 +1,238 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
lb_ids = "${module.create_logic_lb.lb_id}" #Use OCID of Logic LB.
|
||||
web_be1_ip_address1 = "${module.create_wls.PrvIPs}" #Use IP addresses of WLS instances.
|
||||
web_backendset_counts = "3"
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend_set" "lb1-webbes" {
|
||||
depends_on = ["module.create_logic_lb"]
|
||||
count = "${local.web_backendset_counts}"
|
||||
name = "lb1-webbes${count.index + 1}"
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
policy = "ROUND_ROBIN"
|
||||
|
||||
health_checker {
|
||||
port = "0"
|
||||
protocol = "HTTP"
|
||||
response_body_regex = ".*"
|
||||
url_path = "${count.index != "2" ? "/jde/E1Menu.maf" : "/jderest/defaultconfig"}"
|
||||
}
|
||||
session_persistence_configuration {
|
||||
#cookie_name = "*"
|
||||
cookie_name = "JSESSIONID"
|
||||
#disable_fallback = true
|
||||
}
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.0.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend_set" "lb2-webbes" {
|
||||
depends_on = ["module.create_logic_lb"]
|
||||
count = "${local.web_backendset_counts}"
|
||||
name = "lb2-webbes${count.index + 1}"
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
policy = "ROUND_ROBIN"
|
||||
|
||||
health_checker {
|
||||
port = "0"
|
||||
protocol = "HTTP"
|
||||
response_body_regex = ".*"
|
||||
url_path = "${count.index != "2" ? "/jde/E1Menu.maf" : "/jderest/defaultconfig"}"
|
||||
}
|
||||
session_persistence_configuration {
|
||||
#cookie_name = "*"
|
||||
cookie_name = "JSESSIONID"
|
||||
#disable_fallback = true
|
||||
}
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.1.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
}
|
||||
|
||||
# Backends for LB 1.
|
||||
resource "oci_load_balancer_backend" "lb1-webbes1" {
|
||||
count = "${var.wls_instance_count * length(var.listen_port_range_standalone_html)}"
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb1-webbes.*.name, 0)}"
|
||||
ip_address = "${element(local.web_be1_ip_address1, count.index / length(var.listen_port_range_standalone_html))}"
|
||||
port = "${element(var.listen_port_range_standalone_html, count.index % length(var.listen_port_range_standalone_html))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend" "lb1-webbes2" {
|
||||
count = "${var.wls_instance_count * length(var.listen_port_range_html)}"
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb1-webbes.*.name, 1)}"
|
||||
ip_address = "${element(local.web_be1_ip_address1, count.index / length(var.listen_port_range_html))}"
|
||||
port = "${element(var.listen_port_range_html, count.index % length(var.listen_port_range_html))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend" "lb1-webbes3" {
|
||||
count = "${var.wls_instance_count * length(var.listen_port_range_ais)}"
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb1-webbes.*.name, 2)}"
|
||||
ip_address = "${element(local.web_be1_ip_address1, count.index / length(var.listen_port_range_ais))}"
|
||||
port = "${element(var.listen_port_range_ais, count.index % length(var.listen_port_range_ais))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
|
||||
# Backends for LB 2
|
||||
|
||||
resource "oci_load_balancer_backend" "lb2-webbes1" {
|
||||
count = "${var.wls_instance_count * length(var.listen_port_range_standalone_html)}"
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb2-webbes.*.name, 0)}"
|
||||
ip_address = "${element(local.web_be1_ip_address1, count.index / length(var.listen_port_range_standalone_html))}"
|
||||
port = "${element(var.listen_port_range_standalone_html, count.index % length(var.listen_port_range_standalone_html))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend" "lb2-webbes2" {
|
||||
count = "${var.wls_instance_count * length(var.listen_port_range_html)}"
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb2-webbes.*.name, 1)}"
|
||||
ip_address = "${element(local.web_be1_ip_address1, count.index / length(var.listen_port_range_html))}"
|
||||
port = "${element(var.listen_port_range_html, count.index % length(var.listen_port_range_html))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_backend" "lb2-webbes3" {
|
||||
count = "${var.wls_instance_count * length(var.listen_port_range_ais)}"
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
backendset_name = "${element(oci_load_balancer_backend_set.lb2-webbes.*.name, 2)}"
|
||||
ip_address = "${element(local.web_be1_ip_address1, count.index / length(var.listen_port_range_ais))}"
|
||||
port = "${element(var.listen_port_range_ais, count.index % length(var.listen_port_range_ais))}"
|
||||
backup = false
|
||||
drain = false
|
||||
offline = false
|
||||
weight = 1
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb1-weblistener1" {
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
name = "${var.load_balancer_name}-weblsnr1"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb1-webbes.*.name, 0)}"
|
||||
port = "${var.lbaas_listen_port_standalone_html}"
|
||||
protocol = "HTTP"
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.0.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "180"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb1-weblistener2" {
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
name = "${var.load_balancer_name}-weblsnr2"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb1-webbes.*.name, 1)}"
|
||||
port = "${var.lbaas_listen_port_html}"
|
||||
protocol = "HTTP"
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.0.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "180"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb1-weblistener3" {
|
||||
load_balancer_id = "${element(local.lb_ids, 0)}"
|
||||
name = "${var.load_balancer_name}-weblsnr3"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb1-webbes.*.name, 2)}"
|
||||
port = "${var.lbaas_listen_port_ais}"
|
||||
protocol = "HTTP"
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.0.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "180"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb2-weblistener1" {
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
name = "${var.load_balancer_name}-weblsnr1"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb2-webbes.*.name, 0)}"
|
||||
port = "${var.lbaas_listen_port_standalone_html}"
|
||||
protocol = "HTTP"
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.1.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "180"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb2-weblistener2" {
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
name = "${var.load_balancer_name}-weblsnr2"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb2-webbes.*.name, 1)}"
|
||||
port = "${var.lbaas_listen_port_html}"
|
||||
protocol = "HTTP"
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.1.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "180"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_listener" "jdelb2-weblistener3" {
|
||||
load_balancer_id = "${element(local.lb_ids, 1)}"
|
||||
name = "${var.load_balancer_name}-weblsnr3"
|
||||
default_backend_set_name = "${element(oci_load_balancer_backend_set.lb2-webbes.*.name, 2)}"
|
||||
port = "${var.lbaas_listen_port_ais}"
|
||||
protocol = "HTTP"
|
||||
ssl_configuration {
|
||||
certificate_name = "${oci_load_balancer_certificate.jdelb-cert1.1.certificate_name}"
|
||||
verify_peer_certificate = false
|
||||
}
|
||||
connection_configuration {
|
||||
idle_timeout_in_seconds = "180"
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_load_balancer_certificate" "jdelb-cert1" {
|
||||
count = 2
|
||||
load_balancer_id = "${element(local.lb_ids,count.index)}"
|
||||
certificate_name = "${var.load_balancer_certificate_name}"
|
||||
ca_certificate = "${var.load_balancer_ca_certificate}"
|
||||
passphrase = "${var.load_balancer_certificate_passphrase}"
|
||||
private_key = "${var.load_balancer_certificate_private_key}"
|
||||
public_certificate = "${var.load_balancer_certificate_public_certificate}"
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get list of Availability Domains
|
||||
data "oci_identity_availability_domains" "ADs" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
}
|
||||
|
||||
# Get name of Availability Domains
|
||||
data "template_file" "deployment_ad" {
|
||||
count = "${length(var.AD)}"
|
||||
template = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[count.index] - 1], "name")}"
|
||||
}
|
||||
|
||||
|
||||
# Get list of Fault Domains
|
||||
data "oci_identity_fault_domains" "fds" {
|
||||
count = "${length(var.AD)}"
|
||||
availability_domain = "${element(data.template_file.deployment_ad.*.rendered, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
}
|
||||
|
||||
locals {
|
||||
fault_domains = "${flatten(concat(data.oci_identity_fault_domains.fds.*.fault_domains))}"
|
||||
faultdomains_per_ad = 3
|
||||
}
|
||||
|
||||
# Get name of Fault Domains
|
||||
data "template_file" "deployment_fd" {
|
||||
template = "$${name}"
|
||||
count = "${length(var.AD) * (local.faultdomains_per_ad) }"
|
||||
vars = {
|
||||
name = "${lookup(local.fault_domains[count.index], "name")}"
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Oracle Linux image
|
||||
data "oci_core_images" "InstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.instance_os}"
|
||||
operating_system_version = "${var.linux_os_version}"
|
||||
|
||||
filter {
|
||||
name = "display_name"
|
||||
values = ["^.*Oracle[^G]*$"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
|
||||
# Get Windows image
|
||||
data "oci_core_images" "WinInstanceImageOCID" {
|
||||
compartment_id = "${var.tenancy_ocid}"
|
||||
operating_system = "${var.WinInstanceOS}"
|
||||
operating_system_version = "${var.WinInstanceOSVersion}"
|
||||
}
|
||||
|
||||
# Get swift object storage name for Service Gateway
|
||||
data "oci_core_services" "svcgtw_services" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = [".*Object.*Storage"]
|
||||
regex = true
|
||||
}
|
||||
}
|
||||
|
||||
# Render inputs for mounting Filesystem storage service
|
||||
data "template_file" "bootstrap" {
|
||||
template = "${file("${path.module}/userdata/bootstrap.tpl")}"
|
||||
vars {
|
||||
timezone = "${var.timezone}"
|
||||
fss_mount_path = "${var.psft_stage_filesystem_path}/"
|
||||
fss_export_path = "${element(module.create_fss.FilesystemExports, 0)}"
|
||||
fss_mount_target_private_ip = "${element(module.create_fss.FilesystemPrivateIPs, 0)}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
locals {
|
||||
// VCN is /16
|
||||
db_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 0)}"
|
||||
tools_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 1)}"
|
||||
es_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 2)}"
|
||||
app_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 3)}"
|
||||
fss_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 4)}"
|
||||
web_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 5)}"
|
||||
lb_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 6)}"
|
||||
bastion_subnet_prefix = "${cidrsubnet("${var.vcn_cidr}", 6, 7)}"
|
||||
}
|
||||
|
||||
# Create Virtual Cloud Network (VCN)
|
||||
module "create_vcn" {
|
||||
source = "./modules/network/vcn"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
vcn_cidr = "${var.vcn_cidr}"
|
||||
vcn_dns_label = "${var.vcn_dns_label}"
|
||||
}
|
||||
|
||||
# Create bastion host subnet
|
||||
module "bastion_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.bastion_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.bastion_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.bastion_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "bassubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PublicRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.BastionSecList.id}"]
|
||||
private_subnet = "False"
|
||||
}
|
||||
|
||||
# Create Load Balancer subnet
|
||||
module "lb_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.lb_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "lbsubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.LBSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
# Create web subnet
|
||||
module "web_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.web_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.web_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.web_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "websubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.WebSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
|
||||
# Create application subnet
|
||||
module "app_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.app_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.app_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.app_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "appsubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.AppSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
# Create File Storage Service subnet
|
||||
module "fss_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.fss_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.fss_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.fss_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "fsssubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.FSSSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
# Create Database system subnet
|
||||
module "db_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.db_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "dbsubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.DBSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
# Create Elastic Search subnet
|
||||
module "els_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.es_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.es_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.es_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "essubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.ESSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
# Create Peoplesoft Tools subnet
|
||||
module "ptools_subnet" {
|
||||
source = "./modules/network/subnets"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
vcn_id = "${module.create_vcn.vcnid}"
|
||||
vcn_subnet_cidr = [
|
||||
"${cidrsubnet(local.tools_subnet_prefix, 2, 0)}",
|
||||
"${cidrsubnet(local.tools_subnet_prefix, 2, 1)}",
|
||||
"${cidrsubnet(local.tools_subnet_prefix, 2, 2)}",
|
||||
]
|
||||
dns_label = "ptoolssubad"
|
||||
dhcp_options_id = "${module.create_vcn.default_dhcp_id}"
|
||||
route_table_id = "${oci_core_route_table.PrivateRT.id}"
|
||||
security_list_ids = ["${oci_core_security_list.PToolsSecList.id}"]
|
||||
private_subnet = "True"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Create bastion host
|
||||
module "create_bastion" {
|
||||
source = "./modules/bastion"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
bastion_hostname_prefix = "${var.psft_env_prefix}bas${substr(var.region, 3, 3)}"
|
||||
bastion_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
bastion_instance_shape = "${var.bastion_instance_shape}"
|
||||
bastion_subnet = ["${module.bastion_subnet.subnetid}"]
|
||||
bastion_ssh_public_key = "${var.bastion_ssh_public_key}"
|
||||
}
|
||||
|
||||
# Create application server
|
||||
module "create_app" {
|
||||
source = "./modules/compute"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
compute_instance_count = "${var.psft_app_instance_count}"
|
||||
compute_platform = "linux"
|
||||
compute_hostname_prefix = "${var.psft_env_prefix}app${substr(var.region, 3, 3)}"
|
||||
compute_boot_volume_size_in_gb = "${var.compute_boot_volume_size_in_gb}"
|
||||
compute_block_volume_size_in_gb = "${var.compute_block_volume_size_in_gb}"
|
||||
compute_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
compute_instance_shape = "${var.psft_app_instance_shape}"
|
||||
compute_subnet = ["${module.app_subnet.subnetid}"]
|
||||
compute_ssh_public_key = "${var.ssh_public_key}"
|
||||
compute_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${module.create_bastion.Bastion_Public_IPs[0]}"
|
||||
compute_instance_user = "${var.compute_instance_user}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
timezone = "${var.timezone}"
|
||||
user_data = "${data.template_file.bootstrap.rendered}"
|
||||
remote_exec_script = "" #Optional
|
||||
}
|
||||
|
||||
# Create Elastic search server
|
||||
module "create_elastic_search" {
|
||||
source = "./modules/compute"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
compute_instance_count = "${var.psft_es_instance_count}"
|
||||
compute_platform = "linux"
|
||||
compute_hostname_prefix = "${var.psft_env_prefix}es${substr(var.region, 3, 3)}"
|
||||
compute_boot_volume_size_in_gb = "${var.compute_boot_volume_size_in_gb}"
|
||||
compute_block_volume_size_in_gb = "${var.compute_block_volume_size_in_gb}"
|
||||
compute_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
compute_instance_shape = "${var.psft_es_instance_shape}"
|
||||
compute_subnet = ["${module.els_subnet.subnetid}"]
|
||||
compute_ssh_public_key = "${var.ssh_public_key}"
|
||||
compute_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${module.create_bastion.Bastion_Public_IPs[0]}"
|
||||
compute_instance_user = "${var.compute_instance_user}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
timezone = "${var.timezone}"
|
||||
user_data = "${data.template_file.bootstrap.rendered}"
|
||||
remote_exec_script = "" #Optional
|
||||
}
|
||||
|
||||
# Create process scheduler server
|
||||
module "create_process_schd" {
|
||||
source = "./modules/compute"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
compute_platform = "linux"
|
||||
compute_instance_count = "${var.psft_es_instance_count}"
|
||||
compute_hostname_prefix = "${var.psft_env_prefix}ps${substr(var.region, 3, 3)}"
|
||||
compute_boot_volume_size_in_gb = "${var.compute_boot_volume_size_in_gb}"
|
||||
compute_block_volume_size_in_gb = "${var.compute_block_volume_size_in_gb}"
|
||||
compute_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
compute_instance_shape = "${var.psft_ps_instance_shape}"
|
||||
compute_subnet = ["${module.app_subnet.subnetid}"]
|
||||
compute_ssh_public_key = "${var.ssh_public_key}"
|
||||
compute_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${module.create_bastion.Bastion_Public_IPs[0]}"
|
||||
compute_instance_user = "${var.compute_instance_user}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
timezone = "${var.timezone}"
|
||||
user_data = "${data.template_file.bootstrap.rendered}"
|
||||
remote_exec_script = "" #Optional
|
||||
}
|
||||
|
||||
# Create Web server
|
||||
module "create_web" {
|
||||
source = "./modules/compute"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
compute_instance_count = "${var.psft_web_instance_count}"
|
||||
compute_platform = "linux"
|
||||
compute_hostname_prefix = "${var.psft_env_prefix}web${substr(var.region, 3, 3)}"
|
||||
compute_boot_volume_size_in_gb = "${var.compute_boot_volume_size_in_gb}"
|
||||
compute_block_volume_size_in_gb = "${var.compute_block_volume_size_in_gb}"
|
||||
compute_image = "${data.oci_core_images.InstanceImageOCID.images.0.id}"
|
||||
compute_instance_shape = "${var.psft_web_instance_shape}"
|
||||
compute_subnet = ["${module.web_subnet.subnetid}"]
|
||||
compute_ssh_public_key = "${var.ssh_public_key}"
|
||||
compute_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${module.create_bastion.Bastion_Public_IPs[0]}"
|
||||
compute_instance_user = "${var.compute_instance_user}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
timezone = "${var.timezone}"
|
||||
user_data = "${data.template_file.bootstrap.rendered}"
|
||||
remote_exec_script = "" #Optional
|
||||
}
|
||||
|
||||
# Create Peoplesoft tools server
|
||||
module "create_ptools" {
|
||||
source = "./modules/compute"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fault_domain = ["${sort(data.template_file.deployment_fd.*.rendered)}"]
|
||||
compute_instance_count = "${length(var.AD)}"
|
||||
compute_platform = "windows"
|
||||
compute_hostname_prefix = "${var.psft_env_prefix}tls${substr(var.region, 3, 3)}"
|
||||
compute_image = "${data.oci_core_images.WinInstanceImageOCID.images.3.id}"
|
||||
compute_instance_shape = "${var.psft_tls_instance_shape}"
|
||||
compute_subnet = ["${module.ptools_subnet.subnetid}"]
|
||||
compute_boot_volume_size_in_gb = "256"
|
||||
compute_block_volume_size_in_gb = "${var.compute_block_volume_size_in_gb}"
|
||||
compute_ssh_public_key = "${var.ssh_public_key}"
|
||||
compute_ssh_private_key = "${var.ssh_private_key}"
|
||||
bastion_ssh_private_key = "${var.bastion_ssh_private_key}"
|
||||
bastion_public_ip = "${module.create_bastion.Bastion_Public_IPs[0]}"
|
||||
compute_instance_user = "${var.compute_instance_user}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
timezone = "${var.timezone}"
|
||||
user_data = "${data.template_file.bootstrap.rendered}"
|
||||
remote_exec_script = "" #Optional
|
||||
}
|
||||
|
||||
# Create File system service
|
||||
module "create_fss" {
|
||||
source = "./modules/filesystem"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
fss_instance_prefix = "${var.psft_env_prefix}fss${substr(var.region, 3, 3)}"
|
||||
fss_subnet = ["${module.fss_subnet.subnetid}"]
|
||||
fss_limit_size_in_gb = "${var.psft_stage_filesystem_size_limit_in_gb}"
|
||||
fss_count = "1"
|
||||
}
|
||||
|
||||
|
||||
# create Database system
|
||||
|
||||
module "create_db" {
|
||||
source = "./modules/dbsystem"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
db_edition = "${var.db_edition}"
|
||||
db_instance_shape = "${var.db_instance_shape}"
|
||||
db_node_count = "${var.db_node_count}"
|
||||
db_hostname_prefix = "${var.psft_env_prefix}db${substr(var.region, 3, 3)}"
|
||||
db_size_in_gb = "${var.db_size_in_gb}"
|
||||
db_license_model = "${var.db_license_model}"
|
||||
db_subnet = ["${module.db_subnet.subnetid}"]
|
||||
db_ssh_public_key = "${var.ssh_public_key}"
|
||||
db_admin_password = "${var.db_admin_password}"
|
||||
db_name = "${var.db_name}"
|
||||
db_characterset = "${var.db_characterset}"
|
||||
db_nls_characterset = "${var.db_nls_characterset}"
|
||||
db_version = "${var.db_version}"
|
||||
db_pdb_name = "${var.db_pdb_name}"
|
||||
}
|
||||
|
||||
# Create Load Balancer
|
||||
module "create_lb" {
|
||||
source = "./modules/loadbalancer"
|
||||
|
||||
compartment_ocid = "${var.compartment_ocid}"
|
||||
AD = "${var.AD}"
|
||||
availability_domain = ["${data.template_file.deployment_ad.*.rendered}"]
|
||||
load_balancer_shape = "${var.load_balancer_shape}"
|
||||
load_balancer_subnet = ["${module.lb_subnet.subnetid}"]
|
||||
load_balancer_name = "${var.psft_env_prefix}lb${substr(var.region, 3, 3)}"
|
||||
load_balancer_hostname = "${var.load_balancer_hostname}"
|
||||
load_balancer_listen_port = "${var.load_balancer_listen_port}"
|
||||
web_instance_listen_port = "${var.psft_web_instance_listen_port}"
|
||||
web_instance_count = "${var.psft_web_instance_count}"
|
||||
be_ip_addresses = ["${module.create_web.ComputePrivateIPs}"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "Bastion_Public_IPs" {
|
||||
value = ["${oci_core_instance.bastion.*.public_ip}"]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "bastion" {
|
||||
compartment_id = var.compartment_ocid
|
||||
count = length(var.availability_domain)
|
||||
availability_domain = element(var.availability_domain, count.index)
|
||||
display_name = "${var.bastion_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
shape = var.bastion_instance_shape
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = element(var.bastion_subnet, count.index)
|
||||
display_name = "${var.bastion_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
assign_public_ip = true
|
||||
hostname_label = "${var.bastion_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = var.bastion_image
|
||||
boot_volume_size_in_gbs = "60"
|
||||
}
|
||||
|
||||
metadata {
|
||||
ssh_authorized_keys = trimspace(file("${var.bastion_ssh_public_key}"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "AD" {
|
||||
description = "Availability domain"
|
||||
type= "list"
|
||||
}
|
||||
#Bastion host variables
|
||||
variable "bastion_hostname_prefix" {
|
||||
description = "Prefix for bastion hostname"
|
||||
}
|
||||
|
||||
variable "bastion_instance_shape" {
|
||||
description = "Instance shape of bastion host"
|
||||
}
|
||||
variable "bastion_subnet" {
|
||||
description = "Subnet for Bastion host"
|
||||
type = "list"
|
||||
}
|
||||
variable "bastion_image" {
|
||||
description ="OS Image"
|
||||
}
|
||||
variable "bastion_ssh_public_key" {
|
||||
description = "Bastion Host SSH public key"
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_volume" "blockvolume" {
|
||||
#count = "${var.compute_instance_count}"
|
||||
count = "${var.compute_platform == "linux" ? var.compute_instance_count : 0}"
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
display_name = "${var.compute_hostname_prefix}vol${count.index+1}"
|
||||
size_in_gbs = "${var.compute_block_volume_size_in_gb}"
|
||||
}
|
||||
|
||||
resource "oci_core_volume_attachment" "blockvolume_attach" {
|
||||
attachment_type = "iscsi"
|
||||
#count = "${var.compute_instance_count}"
|
||||
count = "${var.compute_platform == "linux" ? var.compute_instance_count : 0}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
instance_id = "${element(oci_core_instance.compute.*.id, count.index)}"
|
||||
volume_id = "${element(oci_core_volume.blockvolume.*.id, count.index)}"
|
||||
|
||||
provisioner "remote-exec" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "30m"
|
||||
host = "${element(oci_core_instance.compute.*.private_ip, count.index)}"
|
||||
user = "${var.compute_instance_user}"
|
||||
private_key = "${file("${var.compute_ssh_private_key}")}"
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_port = "22"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
bastion_private_key = "${file("${var.bastion_ssh_private_key}")}"
|
||||
}
|
||||
|
||||
inline = [
|
||||
"sudo -s bash -c 'iscsiadm -m node -o new -T ${self.iqn} -p ${self.ipv4}:${self.port}'",
|
||||
"sudo -s bash -c 'iscsiadm -m node -o update -T ${self.iqn} -n node.startup -v automatic '",
|
||||
"sudo -s bash -c 'iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -l '",
|
||||
"sudo -s bash -c 'mkfs.ext4 -F /dev/sdb'",
|
||||
"sudo -s bash -c 'mkdir -p /u01'",
|
||||
"sudo -s bash -c 'mount -t ext4 /dev/sdb /u01'",
|
||||
"sudo -s bash -c 'echo \"/dev/sdb /u01 ext4 defaults,noatime,_netdev,nofail 0 2\" >> /etc/fstab'",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Fetch Windows instance credemtials
|
||||
data "oci_core_instance_credentials" "win" {
|
||||
count = "${var.compute_platform != "linux" ? var.compute_instance_count : 0}"
|
||||
instance_id = "${oci_core_instance.compute.*.id[count.index]}"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
output "ComputePrivateIPs" {
|
||||
value = ["${oci_core_instance.compute.*.private_ip}"]
|
||||
}
|
||||
|
||||
output "ComputeWinHostNames" {
|
||||
value = ["${oci_core_instance.compute.*.display_name}"]
|
||||
}
|
||||
|
||||
output "ComputeWinusers" {
|
||||
value = ["${data.oci_core_instance_credentials.win.*.username}"]
|
||||
}
|
||||
|
||||
output "ComputeWincreds" {
|
||||
value = ["${data.oci_core_instance_credentials.win.*.password}"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "random_integer" "rand" {
|
||||
min = 1000000000
|
||||
max = 9999999999
|
||||
}
|
||||
|
||||
locals {
|
||||
remote_exec_script_enabled = "${var.remote_exec_script != "" ? 1 : 0}"
|
||||
}
|
||||
|
||||
resource "null_resource" "initlnx" {
|
||||
depends_on = ["oci_core_instance.compute", "oci_core_volume_attachment.blockvolume_attach"]
|
||||
count = "${local.remote_exec_script_enabled && var.compute_platform == "linux" ? var.compute_instance_count : 0}"
|
||||
|
||||
provisioner "file" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "${var.timeout}"
|
||||
host = "${oci_core_instance.compute.*.private_ip[count.index % var.compute_instance_count]}"
|
||||
user = "${var.compute_instance_user}"
|
||||
private_key = "${file("${var.compute_ssh_private_key}")}"
|
||||
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
bastion_private_key = "${file("${var.bastion_ssh_private_key}")}"
|
||||
}
|
||||
source = "userdata/${var.remote_exec_script}"
|
||||
#content = "${file("${var.remote_exec_script}")}"
|
||||
destination = "/tmp/init_${random_integer.rand.result}.sh"
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
connection {
|
||||
agent = false
|
||||
timeout = "${var.timeout}"
|
||||
host = "${oci_core_instance.compute.*.private_ip[count.index % var.compute_instance_count]}"
|
||||
user = "${var.compute_instance_user}"
|
||||
private_key = "${file("${var.compute_ssh_private_key}")}"
|
||||
|
||||
bastion_host = "${var.bastion_public_ip}"
|
||||
bastion_user = "${var.bastion_user}"
|
||||
bastion_private_key = "${file("${var.bastion_ssh_private_key}")}"
|
||||
}
|
||||
|
||||
inline = [
|
||||
"chmod +x /tmp/init_${random_integer.rand.result}.sh",
|
||||
"while [ ! -f /tmp/init.done ]; do /tmp/init_${random_integer.rand.result}.sh; sleep 10; done",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_core_instance" "compute" {
|
||||
count = var.compute_instance_count
|
||||
availability_domain = element(var.availability_domain, count.index)
|
||||
display_name = "${var.compute_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
fault_domain = element(var.fault_domain, count.index)
|
||||
compartment_id = var.compartment_ocid
|
||||
shape = var.compute_instance_shape
|
||||
|
||||
create_vnic_details {
|
||||
subnet_id = element(var.compute_subnet, count.index)
|
||||
display_name = "${var.compute_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
assign_public_ip = false
|
||||
hostname_label = "${var.compute_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
}
|
||||
|
||||
source_details {
|
||||
source_type = "image"
|
||||
source_id = var.compute_image
|
||||
boot_volume_size_in_gbs = var.compute_boot_volume_size_in_gb
|
||||
}
|
||||
|
||||
metadata {
|
||||
ssh_authorized_keys = trimspace(file("${var.compute_ssh_public_key}"))
|
||||
user_data = base64encode(var.user_data)
|
||||
}
|
||||
|
||||
timeouts {
|
||||
create = var.timeout
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
|
||||
variable "fault_domain" {
|
||||
description = "Fault Domainr"
|
||||
type = "list"
|
||||
}
|
||||
variable "compute_instance_count" {}
|
||||
variable "compute_instance_shape" {}
|
||||
|
||||
variable "compute_hostname_prefix" {
|
||||
description = "Host name"
|
||||
}
|
||||
variable "compute_image" {
|
||||
description ="OS Image"
|
||||
}
|
||||
|
||||
variable "compute_ssh_private_key" {
|
||||
description = "SSH key"
|
||||
}
|
||||
variable "compute_ssh_public_key" {
|
||||
description = "SSH key"
|
||||
}
|
||||
variable "bastion_ssh_private_key" {
|
||||
description = "SSH key"
|
||||
}
|
||||
variable "compute_subnet" {
|
||||
type = "list"
|
||||
description = "subnet"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
type = "list"
|
||||
}
|
||||
variable "AD" {
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "bastion_public_ip" {
|
||||
type="string"
|
||||
}
|
||||
|
||||
variable "compute_boot_volume_size_in_gb" {}
|
||||
variable "compute_block_volume_size_in_gb" {}
|
||||
variable "timeout" {
|
||||
description = "Timeout setting for resource creation "
|
||||
default = "10m"
|
||||
}
|
||||
variable timezone {}
|
||||
variable bastion_user {}
|
||||
variable compute_instance_user {}
|
||||
variable user_data {}
|
||||
variable remote_exec_script {}
|
||||
variable compute_platform {}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
# Get CPU and node and node count for a db shape
|
||||
data "oci_database_db_system_shapes" "db_system_shapes" {
|
||||
availability_domain = "${element(var.availability_domain, count.index)}"
|
||||
compartment_id = "${var.compartment_ocid}"
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.db_instance_shape}"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
resource "oci_database_db_system" "database" {
|
||||
count = length(var.availability_domain)
|
||||
compartment_id = var.compartment_ocid
|
||||
availability_domain = element(var.availability_domain, count.index)
|
||||
cpu_core_count = lookup(data.oci_database_db_system_shapes.db_system_shapes.db_system_shapes[0], "minimum_core_count")
|
||||
database_edition = var.db_edition
|
||||
db_home {
|
||||
database = {
|
||||
"admin_password" = "${var.db_admin_password}"
|
||||
"db_name" = "${var.db_name}"
|
||||
"character_set" = "${var.db_characterset}"
|
||||
"ncharacter_set" = "${var.db_nls_characterset}"
|
||||
"db_workload" = "${var.db_workload}"
|
||||
"pdb_name" = "${var.db_pdb_name}"
|
||||
}
|
||||
db_version = var.db_version
|
||||
display_name = var.db_name
|
||||
}
|
||||
shape = var.db_instance_shape
|
||||
node_count = var.db_node_count
|
||||
data_storage_size_in_gb = var.db_size_in_gb
|
||||
#data_storage_percentage = "40"
|
||||
license_model = var.db_license_model
|
||||
disk_redundancy = var.db_disk_redundancy
|
||||
subnet_id = element(var.db_subnet, count.index)
|
||||
ssh_public_keys = ["${trimspace(file("${var.db_ssh_public_key}"))}"]
|
||||
display_name = "${var.db_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
hostname = "${var.db_hostname_prefix}${element(var.AD, count.index)}${count.index + 1}"
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The Universal Permissive License (UPL), Version 1.0*/
|
||||
|
||||
|
||||
variable "compartment_ocid" {
|
||||
description = "Compartment name"
|
||||
}
|
||||
variable "availability_domain" {
|
||||
description = "Availability domain"
|
||||
type = "list"
|
||||
}
|
||||
variable "AD" {
|
||||
description = "Availability domain"
|
||||
type= "list"
|
||||
}
|
||||
variable "db_subnet" {
|
||||
description = "Subnet for Bastion host"
|
||||
type = "list"
|
||||
}
|
||||
# Database System variables
|
||||
variable "db_edition" {
|
||||
description = "Database Edition"
|
||||
}
|
||||
variable "db_version" {
|
||||
description = "Database version"
|
||||
}
|
||||
variable "db_admin_password" {
|
||||
description = "Database admin password"
|
||||
}
|
||||
variable "db_name" {
|
||||
description = "Database Name"
|
||||
}
|
||||
variable "db_disk_redundancy" {
|
||||
description = "Database disk redundancy for Bare Metal DB System"
|
||||
default="NORMAL"
|
||||
}
|
||||
variable "db_hostname_prefix" {
|
||||
description = "Database hostname prefix"
|
||||
}
|
||||
variable "db_instance_shape" {
|
||||
description = "Database system shape"
|
||||
|
||||
}
|
||||
variable "db_ssh_public_key" {
|
||||
description = "Database public ssh key"
|
||||
}
|
||||
|
||||
variable "db_characterset" {
|
||||
description = "Database characterset"
|
||||
}
|
||||
variable "db_nls_characterset" {
|
||||
description = "Database National characterset"
|
||||
}
|
||||
variable "db_workload" {
|
||||
description = "Database Workload"
|
||||
default = "OLTP"
|
||||
}
|
||||
variable "db_pdb_name" {
|
||||
}
|
||||
variable "db_size_in_gb" {
|
||||
description = "Database size in gb"
|
||||
}
|
||||
|
||||
variable "db_license_model" {
|
||||
description = "Database License Model"
|
||||
}
|
||||
variable "db_node_count" {
|
||||
description = "Database Node count"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user