Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 20 additions & 25 deletions database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,25 @@ locals {
atp_private_endpoint = (var.free_tier == false && var.atp_private_endpoint == true) ? true : false
}

resource "oci_database_autonomous_database" "ATPdatabase" {
admin_password = var.atp_password
compartment_id = var.compartment_ocid
cpu_core_count = var.atp_cpu_core_count
data_storage_size_in_tbs = var.atp_data_storage_size_in_tbs
db_name = var.atp_db_name
db_version = var.atp_db_version
display_name = var.atp_name
freeform_tags = var.atp_freeform_tags
license_model = var.atp_license_model
is_free_tier = var.free_tier
nsg_ids = local.atp_private_endpoint ? [oci_core_network_security_group.ATPSecurityGroup.id] : null
private_endpoint_label = local.atp_private_endpoint ? var.atp_private_endpoint_label : null
subnet_id = local.atp_private_endpoint ? oci_core_subnet.vcn01_subnet_db01.id : null
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
module "terraform-oci-arch-adb" {
source = "github.com/oracle-devrel/terraform-oci-arch-adb"
compartment_ocid = var.compartment_ocid
adb_database_db_name = var.atp_db_name
adb_database_display_name = var.atp_name
adb_password = var.atp_password
adb_database_db_workload = "OLTP"
adb_free_tier = var.free_tier
adb_database_cpu_core_count = var.atp_cpu_core_count
adb_database_data_storage_size_in_tbs = var.atp_data_storage_size_in_tbs
adb_database_db_version = var.atp_db_version
adb_database_freeform_tags = var.atp_freeform_tags
adb_database_license_model = var.atp_license_model
use_existing_vcn = local.atp_private_endpoint
adb_private_endpoint = local.atp_private_endpoint
adb_private_endpoint_label = local.atp_private_endpoint ? var.atp_private_endpoint_label : null
vcn_id = local.atp_private_endpoint ? oci_core_vcn.vcn01.id : null
adb_subnet_id = local.atp_private_endpoint ? oci_core_subnet.vcn01_subnet_db01.id : null
adb_nsg_id = local.atp_private_endpoint ? oci_core_network_security_group.ATPSecurityGroup.id : null
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

resource "random_password" "wallet_password" {
length = 16
special = true
}

resource "oci_database_autonomous_database_wallet" "atp_wallet" {
autonomous_database_id = oci_database_autonomous_database.ATPdatabase.id
password = random_password.wallet_password.result
base64_encode_content = "true"
}
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ output "generated_ssh_private_key" {
}

output "wallet_password" {
value = [random_password.wallet_password.result]
value = [module.terraform-oci-arch-adb.adb_database.adb_wallet_content]
sensitive = true
}
4 changes: 2 additions & 2 deletions remote.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ data "template_file" "tomcat_context_xml" {
}

resource "null_resource" "tomcat-server-config" {
depends_on = [oci_core_instance.tomcat-server, oci_database_autonomous_database.ATPdatabase]
depends_on = [oci_core_instance.tomcat-server, module.terraform-oci-arch-adb.adb_database]
count = var.numberOfNodes

provisioner "local-exec" {
command = "echo '${oci_database_autonomous_database_wallet.atp_wallet.content}' >> ${var.atp_tde_wallet_zip_file}_encoded-${count.index}"
command = "echo '${module.terraform-oci-arch-adb.adb_database.adb_wallet_content}' >> ${var.atp_tde_wallet_zip_file}_encoded-${count.index}"
}

provisioner "local-exec" {
Expand Down
21 changes: 15 additions & 6 deletions schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ variables:
type: enum
title: "LoadBalancer Shape"
description: "Choose LoadBalancer Shape"
default: "10Mbps-Micro"
default: "flexible"
required: false
enum:
- "flexible"
Expand Down Expand Up @@ -209,7 +209,7 @@ variables:
flex_lb_max_shape:
type: enum
required: false
default: "100"
default: "10"
title: "LB Flex Max Shape"
description: "Choose Maximum Shape for Flex Load Balancer."
enum:
Expand Down Expand Up @@ -355,7 +355,7 @@ variables:
minimum: 1
maximum: 128
multipleOf: 1
default: 10
default: 6
title: "Flex Shape Memory (GB)"
description: "Choose number GB for Flex Shape Memory."
visible:
Expand Down Expand Up @@ -399,7 +399,11 @@ variables:
required: true
title: "ATP Database Private Endpoint"
description: "Check the box to deploy ATP Database with Private Endpoint."
visible: free_tier
visible:
and:
- eq:
- free_tier
- false

atp_cpu_core_count:
type: number
Expand Down Expand Up @@ -470,8 +474,13 @@ variables:
required: false
visible:
and:
- ATP_private_endpoint
- free_tier
- eq:
- ATP_private_endpoint
- true
- eq:
- free_tier
- false

default: "ATPPrivateEndpoint"
title: "ATP Database Private Endpoint Label"
description: "Choose ATP Database Private Endpoint label."
Expand Down
2 changes: 1 addition & 1 deletion scripts/tomcat_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ sudo -u tomcat nohup /u01/apache-tomcat-${tomcat_version}/bin/startup.sh &

# Download TODOAPP and deploy in Tomcat
echo '== 8. Download TODOAPP and deploy in Tomcat'
wget -O /home/opc/todoapp.war https://github.com/oracle-quickstart/oci-arch-tomcat-autonomous/releases/latest/download/todoapp-atp.war
wget -O /home/opc/todoapp.war https://github.com/oracle-devrel/terraform-oci-arch-tomcat-autonomous/releases/latest/download/todoapp-atp.war
chown opc:opc /home/opc/todoapp.war
cp /home/opc/todoapp.war /u01/apache-tomcat-${tomcat_version}/webapps
chown tomcat:tomcat /u01/apache-tomcat-${tomcat_version}/webapps/todoapp.war
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ variable "vcn01_subnet_db01_display_name" {
}

variable "lb_shape" {
default = "10Mbps-Micro"
default = "flexible"
}

variable "flex_lb_min_shape" {
default = "10"
}

variable "flex_lb_max_shape" {
default = "100"
default = "10"
}

variable "InstanceShape" {
Expand Down