Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 63c4914

Browse files
committed
Added random id to db name to make stack deployable multiple times
1 parent 4bfa3a2 commit 63c4914

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

terraform/apex.tf

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
resource "oci_database_autonomous_database" "apex_instance" {
2-
#Required
3-
compartment_id = var.compartment_ocid
4-
cpu_core_count = 1
5-
db_name = "Apex"
6-
data_storage_size_in_tbs=1
7-
license_model="LICENSE_INCLUDED"
8-
#Optional
9-
admin_password = var.autonomous_database_admin_password
10-
11-
db_workload = "APEX"
12-
13-
}
2+
compartment_id = var.compartment_ocid
3+
cpu_core_count = 1
4+
db_name = "apex${random_string.deploy_id.result}"
5+
data_storage_size_in_tbs = 1
6+
license_model = "LICENSE_INCLUDED"
7+
admin_password = var.autonomous_database_admin_password
8+
9+
db_workload = "APEX"
10+
11+
}
12+
13+
resource "random_string" "deploy_id" {
14+
length = 4
15+
special = false
16+
}

terraform/provider.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2+
terraform {
3+
required_providers {
4+
5+
oci = {
6+
source = "hashicorp/oci"
7+
}
8+
random = {
9+
source = "hashicorp/random"
10+
}
11+
12+
}
13+
required_version = ">= 0.14"
14+
}
15+
116
provider "oci" {
217
tenancy_ocid = var.tenancy_ocid
318
region = var.region

terraform/variables.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
variable "tenancy_ocid" {}
2-
variable "compartment_ocid" {}
32
variable "region" {}
3+
44
variable "fingerprint" {}
55
variable "private_key_path" {}
66
variable "user_ocid" {}
77

8+
variable "compartment_ocid" {}
9+
810

911
variable "autonomous_database_admin_password" {
1012
description = "Password for Apex Admin user."

0 commit comments

Comments
 (0)