|
| 1 | +// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | +// Licensed under the Mozilla Public License v2.0 |
| 3 | + |
| 4 | +resource "oci_core_vcn" "test_vcn" { |
| 5 | + compartment_id = var.compartment_ocid |
| 6 | + cidr_block = "10.1.0.0/16" |
| 7 | + display_name = "TestVcn" |
| 8 | + dns_label = "examplevcn" |
| 9 | +} |
| 10 | + |
| 11 | +data "oci_identity_availability_domain" "ad" { |
| 12 | + compartment_id = var.compartment_ocid |
| 13 | + ad_number = 1 |
| 14 | +} |
| 15 | + |
| 16 | +resource "oci_core_security_list" "exadata_shapes_security_list" { |
| 17 | + compartment_id = var.compartment_ocid |
| 18 | + vcn_id = oci_core_vcn.test_vcn.id |
| 19 | + display_name = "ExadataSecurityList" |
| 20 | + |
| 21 | + ingress_security_rules { |
| 22 | + source = "10.1.22.0/24" |
| 23 | + protocol = "6" |
| 24 | + } |
| 25 | + |
| 26 | + ingress_security_rules { |
| 27 | + source = "10.1.22.0/24" |
| 28 | + protocol = "1" |
| 29 | + } |
| 30 | + |
| 31 | + egress_security_rules { |
| 32 | + destination = "10.1.22.0/24" |
| 33 | + protocol = "6" |
| 34 | + } |
| 35 | + |
| 36 | + egress_security_rules { |
| 37 | + destination = "10.1.22.0/24" |
| 38 | + protocol = "1" |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +resource "oci_core_subnet" "exadata_subnet" { |
| 43 | + availability_domain = data.oci_identity_availability_domain.ad.name |
| 44 | + cidr_block = "10.1.22.0/24" |
| 45 | + display_name = "TestExadataSubnet" |
| 46 | + compartment_id = var.compartment_ocid |
| 47 | + vcn_id = oci_core_vcn.test_vcn.id |
| 48 | + route_table_id = oci_core_vcn.test_vcn.default_route_table_id |
| 49 | + dhcp_options_id = oci_core_vcn.test_vcn.default_dhcp_options_id |
| 50 | + security_list_ids = [oci_core_vcn.test_vcn.default_security_list_id, oci_core_security_list.exadata_shapes_security_list.id] |
| 51 | + dns_label = "subnetexadata" |
| 52 | +} |
| 53 | + |
| 54 | +resource "oci_database_autonomous_exadata_infrastructure" "test_autonomous_exadata_infrastructure" { |
| 55 | + availability_domain = data.oci_identity_availability_domain.ad.name |
| 56 | + compartment_id = var.compartment_ocid |
| 57 | + display_name = "TestExadata11" |
| 58 | + domain = var.autonomous_exadata_infrastructure_domain |
| 59 | + freeform_tags = var.autonomous_database_freeform_tags |
| 60 | + license_model = "LICENSE_INCLUDED" |
| 61 | + |
| 62 | + create_async = true |
| 63 | + maintenance_window_details { |
| 64 | + preference = "CUSTOM_PREFERENCE" |
| 65 | + |
| 66 | + days_of_week { |
| 67 | + name = "MONDAY" |
| 68 | + } |
| 69 | + |
| 70 | + hours_of_day = ["4"] |
| 71 | + |
| 72 | + months { |
| 73 | + name = "JANUARY" |
| 74 | + } |
| 75 | + |
| 76 | + months { |
| 77 | + name = "APRIL" |
| 78 | + } |
| 79 | + |
| 80 | + months { |
| 81 | + name = "JULY" |
| 82 | + } |
| 83 | + |
| 84 | + months { |
| 85 | + name = "OCTOBER" |
| 86 | + } |
| 87 | + |
| 88 | + weeks_of_month = ["2"] |
| 89 | + } |
| 90 | + |
| 91 | + nsg_ids = [oci_core_network_security_group.test_network_security_group.id] |
| 92 | + shape = "Exadata.Quarter2.92" |
| 93 | + subnet_id = oci_core_subnet.exadata_subnet.id |
| 94 | +} |
| 95 | + |
| 96 | +resource "oci_core_network_security_group" "test_network_security_group" { |
| 97 | + #Required |
| 98 | + compartment_id = var.compartment_ocid |
| 99 | + vcn_id = oci_core_vcn.test_vcn.id |
| 100 | +} |
| 101 | + |
| 102 | +data "oci_database_autonomous_exadata_infrastructures" "test_autonomous_exadata_infrastructures" { |
| 103 | + availability_domain = data.oci_identity_availability_domain.ad.name |
| 104 | + compartment_id = var.compartment_ocid |
| 105 | + display_name = "TestExadata" |
| 106 | +} |
| 107 | + |
| 108 | +data "oci_database_autonomous_exadata_infrastructure" "test_autonomous_exadata_infrastructure" { |
| 109 | + autonomous_exadata_infrastructure_id = oci_database_autonomous_exadata_infrastructure.test_autonomous_exadata_infrastructure.id |
| 110 | +} |
| 111 | + |
| 112 | +output "test_autonomous_exadata_infrastructures" { |
| 113 | + value = [data.oci_database_autonomous_exadata_infrastructures.test_autonomous_exadata_infrastructures.autonomous_exadata_infrastructures] |
| 114 | +} |
| 115 | + |
0 commit comments