|
| 1 | +# Variables |
| 2 | +variable "compartment_id" { type = string } |
| 3 | +variable "db_admin_password" { type = string } |
| 4 | +variable "db_name" { type = string } |
| 5 | +variable "db_public_keys" { type = list(string) } |
| 6 | +variable "db_subnet_id" { type = string } |
| 7 | +variable "db_display_name" { type = string } |
| 8 | +variable "db_pdb_name" { type = string } |
| 9 | +variable "db_hostname" { type = string } |
| 10 | +variable "db_host_domain" { type = string } |
| 11 | +variable "db_storage_gb" { type = number } |
| 12 | + |
| 13 | +variable "db_workload" { |
| 14 | + type = string |
| 15 | + default = "OLTP" |
| 16 | +} |
| 17 | + |
| 18 | +variable "db_version" { |
| 19 | + type = string |
| 20 | + default = "21.1.0.0" |
| 21 | +} |
| 22 | + |
| 23 | +variable "db_shape" { |
| 24 | + type = string |
| 25 | + default = "VM.Standard2.1" |
| 26 | +} |
| 27 | + |
| 28 | +variable "db_database_edition" { |
| 29 | + type = string |
| 30 | + default = "ENTERPRISE_EDITION_EXTREME_PERFORMANCE" |
| 31 | +} |
| 32 | + |
| 33 | +variable "db_license_model" { |
| 34 | + type = string |
| 35 | + default = "LICENSE_INCLUDED" |
| 36 | +} |
| 37 | + |
| 38 | +variable "db_node_count" { |
| 39 | + type = number |
| 40 | + default = 1 |
| 41 | +} |
| 42 | + |
| 43 | + |
| 44 | +# Resources |
| 45 | +data "oci_identity_availability_domains" "ads" { |
| 46 | + compartment_id = var.compartment_id |
| 47 | +} |
| 48 | + |
| 49 | +resource "oci_database_db_system" "tf_db" { |
| 50 | + availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name |
| 51 | + compartment_id = var.compartment_id |
| 52 | + db_home { |
| 53 | + database { |
| 54 | + admin_password = var.db_admin_password |
| 55 | + db_name = var.db_name |
| 56 | + db_workload = var.db_workload |
| 57 | + pdb_name = var.db_pdb_name |
| 58 | + } |
| 59 | + db_version = var.db_version |
| 60 | + } |
| 61 | + hostname = var.db_hostname |
| 62 | + shape = var.db_shape |
| 63 | + ssh_public_keys = var.db_public_keys |
| 64 | + subnet_id = var.db_subnet_id |
| 65 | + display_name = var.db_display_name |
| 66 | + data_storage_size_in_gb = var.db_storage_gb |
| 67 | + database_edition = var.db_database_edition |
| 68 | + domain = var.db_host_domain |
| 69 | + license_model = var.db_license_model |
| 70 | + node_count = var.db_node_count |
| 71 | +} |
| 72 | + |
| 73 | + |
| 74 | +# Outputs |
| 75 | +output "db_display_name" { |
| 76 | + value = oci_database_db_system.tf_db.display_name |
| 77 | +} |
| 78 | + |
| 79 | +output "db_id" { |
| 80 | + value = oci_database_db_system.tf_db.id |
| 81 | +} |
| 82 | + |
| 83 | +output "db_state" { |
| 84 | + value = oci_database_db_system.tf_db.state |
| 85 | +} |
| 86 | + |
| 87 | +output "first-availability-domain_name" { |
| 88 | + value = data.oci_identity_availability_domains.ads.availability_domains[0].name |
| 89 | +} |
0 commit comments