|
| 1 | +// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | + |
| 3 | +resource "oci_core_virtual_network" "t" { |
| 4 | + compartment_id = "${var.compartment_ocid}" |
| 5 | + cidr_block = "10.1.0.0/16" |
| 6 | + display_name = "-tf-vcn" |
| 7 | + dns_label = "tfvcn" |
| 8 | +} |
| 9 | + |
| 10 | +data "oci_identity_availability_domain" "ad" { |
| 11 | + compartment_id = "${var.compartment_ocid}" |
| 12 | + ad_number = 1 |
| 13 | +} |
| 14 | + |
| 15 | +resource "oci_core_security_list" "exadata_shapes_security_list" { |
| 16 | + compartment_id = "${var.compartment_ocid}" |
| 17 | + vcn_id = "${oci_core_virtual_network.t.id}" |
| 18 | + display_name = "ExadataSecurityList" |
| 19 | + |
| 20 | + ingress_security_rules { |
| 21 | + source = "10.1.22.0/24" |
| 22 | + protocol = "6" |
| 23 | + } |
| 24 | + |
| 25 | + ingress_security_rules { |
| 26 | + source = "10.1.22.0/24" |
| 27 | + protocol = "1" |
| 28 | + } |
| 29 | + |
| 30 | + egress_security_rules { |
| 31 | + destination = "10.1.22.0/24" |
| 32 | + protocol = "6" |
| 33 | + } |
| 34 | + |
| 35 | + egress_security_rules { |
| 36 | + destination = "10.1.22.0/24" |
| 37 | + protocol = "1" |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +resource "oci_core_subnet" "exadata_subnet" { |
| 42 | + availability_domain = "${data.oci_identity_availability_domain.ad.name}" |
| 43 | + cidr_block = "10.1.22.0/24" |
| 44 | + display_name = "ExadataSubnet" |
| 45 | + compartment_id = "${var.compartment_ocid}" |
| 46 | + vcn_id = "${oci_core_virtual_network.t.id}" |
| 47 | + route_table_id = "${oci_core_virtual_network.t.default_route_table_id}" |
| 48 | + dhcp_options_id = "${oci_core_virtual_network.t.default_dhcp_options_id}" |
| 49 | + security_list_ids = ["${oci_core_virtual_network.t.default_security_list_id}", "${oci_core_security_list.exadata_shapes_security_list.id}"] |
| 50 | + dns_label = "subnetexadata" |
| 51 | +} |
| 52 | + |
| 53 | +resource "oci_database_autonomous_exadata_infrastructure" "test_autonomous_exadata_infrastructure" { |
| 54 | + availability_domain = "${data.oci_identity_availability_domain.ad.name}" |
| 55 | + compartment_id = "${var.compartment_ocid}" |
| 56 | + display_name = "exadata-display-name" |
| 57 | + domain = "${var.autonomous_exadata_infrastructure_domain}" |
| 58 | + freeform_tags = "${var.autonomous_database_freeform_tags}" |
| 59 | + license_model = "LICENSE_INCLUDED" |
| 60 | + |
| 61 | + maintenance_window_details { |
| 62 | + preference = "CUSTOM_PREFERENCE" |
| 63 | + |
| 64 | + days_of_week = { |
| 65 | + name = "MONDAY" |
| 66 | + } |
| 67 | + |
| 68 | + hours_of_day = ["2"] |
| 69 | + |
| 70 | + months = { |
| 71 | + name = "APRIL" |
| 72 | + } |
| 73 | + |
| 74 | + weeks_of_month = ["2"] |
| 75 | + } |
| 76 | + |
| 77 | + shape = "${var.autonomous_exadata_infrastructure_shape}" |
| 78 | + subnet_id = "${oci_core_subnet.exadata_subnet.id}" |
| 79 | +} |
| 80 | + |
| 81 | +data "oci_database_autonomous_exadata_infrastructures" "test_autonomous_exadata_infrastructures" { |
| 82 | + availability_domain = "${data.oci_identity_availability_domain.ad.name}" |
| 83 | + compartment_id = "${var.compartment_ocid}" |
| 84 | + display_name = "exadata-display-name" |
| 85 | + state = "AVAILABLE" |
| 86 | +} |
| 87 | + |
| 88 | +output "test_autonomous_exadata_infrastructure" { |
| 89 | + value = "${data.oci_database_autonomous_exadata_infrastructures.test_autonomous_exadata_infrastructures.autonomous_exadata_infrastructures}" |
| 90 | +} |
0 commit comments