1+ # $Header$
2+ #
3+ # Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+ # NAME
5+ # network.tf - Resources file
6+ #
7+ # USAGE
8+ # Example & Backward Compatibility Path: database/db_systems/db_vm/db_backup
9+ # NOTES
10+ # Terraform Integration Test: TestDatabaseBackupResource_basic
11+ # FILES
12+ #
13+ # DESCRIPTION
14+ #
15+ # MODIFIED MM/DD/YY
16+ # escabrer 11/1/2024 - Created
17+
18+
19+ resource "oci_core_vcn" "test_vcn" {
20+ display_name = " tfVcnForDatabaseBackupExample"
21+ cidr_block = " 10.0.0.0/16"
22+ compartment_id = var. compartment_id
23+ dns_label = " tfvcn"
24+ }
25+
26+ resource "oci_core_route_table" "test_route_table" {
27+ display_name = " tfRouteTable"
28+ compartment_id = var. compartment_id
29+ route_rules {
30+ cidr_block = " 0.0.0.0/0"
31+ description = " Internal traffic for OCI Services"
32+ network_entity_id = oci_core_internet_gateway. test_internet_gateway . id
33+ }
34+ vcn_id = oci_core_vcn. test_vcn . id
35+ }
36+
37+ resource "oci_core_internet_gateway" "test_internet_gateway" {
38+ display_name = " tfInternetGateway"
39+ compartment_id = var. compartment_id
40+ defined_tags = map (" ${ oci_identity_tag_namespace . tag-namespace1 . name } .${ oci_identity_tag . tag1 . name } " , " value" )
41+ enabled = " true"
42+ freeform_tags = {
43+ " Department" = " Finance"
44+ }
45+ lifecycle {
46+ ignore_changes = [defined_tags ]
47+ }
48+ vcn_id = oci_core_vcn. test_vcn . id
49+ }
50+
51+ resource "oci_core_subnet" "test_subnet" {
52+ display_name = " tfPublicSubnet"
53+ cidr_block = " 10.0.0.0/24"
54+ compartment_id = var. compartment_id
55+ dhcp_options_id = oci_core_vcn. test_vcn . default_dhcp_options_id
56+ dns_label = " tfpublicsubnet"
57+ route_table_id = oci_core_route_table. test_route_table . id
58+ security_list_ids = [oci_core_vcn . test_vcn . default_security_list_id ]
59+ vcn_id = oci_core_vcn. test_vcn . id
60+ }
61+
62+ resource "oci_core_security_list" "test_private_subnet_security_list" {
63+ display_name = " tfRecoveryServiceSecurityList"
64+ compartment_id = var. compartment_id
65+ egress_security_rules {
66+ destination = " 0.0.0.0/0"
67+ protocol = " all"
68+ }
69+ ingress_security_rules {
70+ protocol = " 6"
71+ source = " 10.0.0.0/16"
72+ source_type = " CIDR_BLOCK"
73+ tcp_options {
74+ min = " 8005"
75+ max = " 8005"
76+ }
77+ }
78+ ingress_security_rules {
79+ protocol = " 6"
80+ source = " 10.0.0.0/16"
81+ source_type = " CIDR_BLOCK"
82+ tcp_options {
83+ min = " 2484"
84+ max = " 2484"
85+ }
86+ }
87+ vcn_id = oci_core_vcn. test_vcn . id
88+ }
89+
90+ resource "oci_core_service_gateway" "test_service_gateway" {
91+ display_name = " tfRecoveryServiceServiceGateway"
92+ compartment_id = var. compartment_id
93+ services {
94+ service_id = data. oci_core_services . test_services . services . 0 . id
95+ }
96+ vcn_id = oci_core_vcn. test_vcn . id
97+ }
98+
99+ resource "oci_core_route_table" "test_private_subnet_route_table" {
100+ display_name = " tfRecoveryServicePrivateSubnetRouteTable"
101+ compartment_id = var. compartment_id
102+ route_rules {
103+ description = " Recovery Service traffic for OCI Services"
104+ destination = data. oci_core_services . test_services . services [0 ]. cidr_block
105+ destination_type = " SERVICE_CIDR_BLOCK"
106+ network_entity_id = oci_core_service_gateway. test_service_gateway . id
107+ }
108+ vcn_id = oci_core_vcn. test_vcn . id
109+ }
110+
111+ resource "oci_core_subnet" "test_private_subnet" {
112+ display_name = " tfPrivateSubnet"
113+ cidr_block = " 10.0.1.0/24"
114+ compartment_id = var. compartment_id
115+ dhcp_options_id = oci_core_vcn. test_vcn . default_dhcp_options_id
116+ dns_label = " tfprivatesubnet"
117+ prohibit_public_ip_on_vnic = " true"
118+ route_table_id = oci_core_route_table. test_private_subnet_route_table . id
119+ security_list_ids = [oci_core_security_list . test_private_subnet_security_list . id ]
120+ vcn_id = oci_core_vcn. test_vcn . id
121+ }
0 commit comments