|
| 1 | +// Copyright (c) 2017 2019 Oracle and/or its affiliates. All rights reserved. |
| 2 | + |
| 3 | +resource "oci_database_vm_cluster_network" "test_vm_cluster_network" { |
| 4 | + compartment_id = "${var.compartment_id}" |
| 5 | + display_name = "testVmClusterRecommendedNetwork" |
| 6 | + dns = ["192.168.10.10"] |
| 7 | + ntp = ["192.168.10.20"] |
| 8 | + |
| 9 | + exadata_infrastructure_id = "${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}" |
| 10 | + |
| 11 | + scans { |
| 12 | + hostname = "myprefix1-nsubz-scan" |
| 13 | + |
| 14 | + ips = [ |
| 15 | + "192.168.19.7", |
| 16 | + "192.168.19.6", |
| 17 | + "192.168.19.8", |
| 18 | + ] |
| 19 | + |
| 20 | + port = 1521 |
| 21 | + } |
| 22 | + |
| 23 | + vm_networks { |
| 24 | + domain_name = "oracle.com" |
| 25 | + gateway = "192.169.20.1" |
| 26 | + netmask = "255.255.0.0" |
| 27 | + network_type = "BACKUP" |
| 28 | + |
| 29 | + nodes { |
| 30 | + hostname = "myprefix2-cghdm1" |
| 31 | + ip = "192.169.19.1" |
| 32 | + } |
| 33 | + |
| 34 | + nodes { |
| 35 | + hostname = "myprefix2-cghdm2" |
| 36 | + ip = "192.169.19.2" |
| 37 | + } |
| 38 | + |
| 39 | + vlan_id = "11" |
| 40 | + } |
| 41 | + |
| 42 | + vm_networks { |
| 43 | + domain_name = "oracle.com" |
| 44 | + gateway = "192.168.20.1" |
| 45 | + netmask = "255.255.0.0" |
| 46 | + network_type = "CLIENT" |
| 47 | + |
| 48 | + nodes { |
| 49 | + hostname = "myprefix1-r64zc1" |
| 50 | + ip = "192.168.19.2" |
| 51 | + vip = "192.168.19.3" |
| 52 | + vip_hostname = "myprefix1-r64zc1-vip" |
| 53 | + } |
| 54 | + |
| 55 | + nodes { |
| 56 | + hostname = "myprefix1-r64zc2" |
| 57 | + ip = "192.168.19.4" |
| 58 | + vip = "192.168.19.5" |
| 59 | + vip_hostname = "myprefix1-r64zc2-vip" |
| 60 | + } |
| 61 | + |
| 62 | + vlan_id = "10" |
| 63 | + } |
| 64 | + |
| 65 | + #Optional |
| 66 | + defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedvalue")}" |
| 67 | + |
| 68 | + freeform_tags = { |
| 69 | + "Department" = "Accounting" |
| 70 | + } |
| 71 | + |
| 72 | + validate_vm_cluster_network = true |
| 73 | +} |
| 74 | + |
| 75 | +resource "oci_database_vm_cluster" "test_vm_cluster" { |
| 76 | + #Required |
| 77 | + compartment_id = "${var.compartment_id}" |
| 78 | + cpu_core_count = "2" |
| 79 | + display_name = "testVmCluster" |
| 80 | + exadata_infrastructure_id = "${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}" |
| 81 | + gi_version = "19.1.0.0" |
| 82 | + ssh_public_keys = ["${var.ssh_public_key}"] |
| 83 | + vm_cluster_network_id = "${oci_database_vm_cluster_network.test_vm_cluster_network.id}" |
| 84 | + |
| 85 | + #Optional |
| 86 | + defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedvalue")}" |
| 87 | + |
| 88 | + freeform_tags = { |
| 89 | + "Department" = "Accounting" |
| 90 | + } |
| 91 | + |
| 92 | + is_local_backup_enabled = "false" |
| 93 | + is_sparse_diskgroup_enabled = "false" |
| 94 | + license_model = "LICENSE_INCLUDED" |
| 95 | +} |
| 96 | + |
| 97 | +data "oci_database_vm_cluster_recommended_network" "test_vm_cluster_recommended_network" { |
| 98 | + #Required |
| 99 | + compartment_id = "${var.compartment_id}" |
| 100 | + display_name = "testVmClusterRecommendedNetwork" |
| 101 | + exadata_infrastructure_id = "${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}" |
| 102 | + |
| 103 | + networks { |
| 104 | + #Required |
| 105 | + cidr = "192.168.19.2/16" |
| 106 | + domain = "oracle.com" |
| 107 | + gateway = "192.168.20.1" |
| 108 | + netmask = "255.255.0.0" |
| 109 | + network_type = "CLIENT" |
| 110 | + prefix = "myprefix1" |
| 111 | + vlan_id = "10" |
| 112 | + domain = "oracle.com" |
| 113 | + } |
| 114 | + |
| 115 | + networks { |
| 116 | + #Required |
| 117 | + cidr = "192.169.19.1/16" |
| 118 | + domain = "oracle.com" |
| 119 | + gateway = "192.169.20.1" |
| 120 | + netmask = "255.255.0.0" |
| 121 | + network_type = "BACKUP" |
| 122 | + prefix = "myprefix2" |
| 123 | + vlan_id = "11" |
| 124 | + domain = "oracle.com" |
| 125 | + } |
| 126 | + |
| 127 | + defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedvalue")}" |
| 128 | + |
| 129 | + freeform_tags = { |
| 130 | + "Department" = "Accounting" |
| 131 | + } |
| 132 | +} |
| 133 | + |
| 134 | +resource "oci_database_db_home" "test_db_home_vm_cluster" { |
| 135 | + vm_cluster_id = "${oci_database_vm_cluster.test_vm_cluster.id}" |
| 136 | + |
| 137 | + database { |
| 138 | + admin_password = "BEstrO0ng_#11" |
| 139 | + db_name = "dbVMClus" |
| 140 | + character_set = "AL32UTF8" |
| 141 | + ncharacter_set = "AL16UTF16" |
| 142 | + db_workload = "OLTP" |
| 143 | + pdb_name = "pdbName" |
| 144 | + |
| 145 | + freeform_tags = { |
| 146 | + "Department" = "Finance" |
| 147 | + } |
| 148 | + |
| 149 | + db_backup_config { |
| 150 | + auto_backup_enabled = true |
| 151 | + auto_backup_window = "SLOT_TWO" |
| 152 | + |
| 153 | + backup_destination_details { |
| 154 | + id = "${oci_database_backup_destination.test_backup_destination_recovery_appliance.id}" |
| 155 | + type = "NFS" |
| 156 | + } |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + source = "VM_CLUSTER_NEW" |
| 161 | + db_version = "12.1.0.2" |
| 162 | + display_name = "createdDbHome" |
| 163 | +} |
| 164 | + |
| 165 | +resource "oci_database_backup_destination" "test_backup_destination_recovery_appliance" { |
| 166 | + #Required |
| 167 | + compartment_id = "${var.compartment_id}" |
| 168 | + display_name = "testBackupDestinationRecovery Appliance" |
| 169 | + type = "RECOVERY_APPLIANCE" |
| 170 | + |
| 171 | + #Optional |
| 172 | + connection_string = "connectionString" |
| 173 | + |
| 174 | + freeform_tags = { |
| 175 | + "Department" = "Finance" |
| 176 | + } |
| 177 | + |
| 178 | + vpc_users = ["bkupUser1", "bkupUser2"] |
| 179 | +} |
| 180 | + |
| 181 | +data "oci_database_vm_cluster_network_download_config_file" "test_vm_cluster_network_download_config_file" { |
| 182 | + #Required |
| 183 | + exadata_infrastructure_id = "${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}" |
| 184 | + vm_cluster_network_id = "${oci_database_vm_cluster_network.test_vm_cluster_network.id}" |
| 185 | + |
| 186 | + #Optional |
| 187 | + base64_encode_content = true |
| 188 | +} |
| 189 | + |
| 190 | +data "oci_database_vm_cluster_networks" "test_vm_cluster_networks" { |
| 191 | + #Required |
| 192 | + compartment_id = "${var.compartment_id}" |
| 193 | + exadata_infrastructure_id = "${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}" |
| 194 | +} |
| 195 | + |
| 196 | +data "oci_database_vm_clusters" "test_vm_clusters" { |
| 197 | + #Required |
| 198 | + compartment_id = "${var.compartment_id}" |
| 199 | + |
| 200 | + #Optional |
| 201 | + exadata_infrastructure_id = "${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}" |
| 202 | +} |
| 203 | + |
| 204 | +resource "local_file" "test_vm_cluster_network_downloaded_config_file" { |
| 205 | + content = "${data.oci_database_vm_cluster_network_download_config_file.test_vm_cluster_network_download_config_file.content}" |
| 206 | + filename = "${path.module}/vm_cluster_config.txt" |
| 207 | +} |
0 commit comments