11// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
22// Licensed under the Mozilla Public License v2.0
33
4- variable "tenancy_ocid" {
5- }
6-
7- variable "user_ocid" {
8- }
9-
10- variable "fingerprint" {
11- }
12-
13- variable "private_key_path" {
14- }
15-
16- variable "region" {
17- }
184
19- variable "compartment_ocid" {
20- }
21-
22- provider "oci" {
23- tenancy_ocid = var. tenancy_ocid
24- user_ocid = var. user_ocid
25- fingerprint = var. fingerprint
26- private_key_path = var. private_key_path
27- region = var. region
28- }
29-
30- variable "instance_image_ocid" {
31- type = map (string )
32-
33- default = {
34- # See https://docs.us-phoenix-1.oraclecloud.com/images/
35- # Oracle-provided image "Oracle-Linux-7.5-2018.10.16-0"
36- us-phoenix-1 = " ocid1.image.oc1.phx.aaaaaaaaoqj42sokaoh42l76wsyhn3k2beuntrh5maj3gmgmzeyr55zzrwwa"
37- us-ashburn-1 = " ocid1.image.oc1.iad.aaaaaaaageeenzyuxgia726xur4ztaoxbxyjlxogdhreu3ngfj2gji3bayda"
38- eu-frankfurt-1 = " ocid1.image.oc1.eu-frankfurt-1.aaaaaaaaitzn6tdyjer7jl34h2ujz74jwy5nkbukbh55ekp6oyzwrtfa4zma"
39- uk-london-1 = " ocid1.image.oc1.uk-london-1.aaaaaaaa32voyikkkzfxyo4xbdmadc2dmvorfxxgdhpnk6dw64fa3l4jh7wa"
40- }
41- }
425
436resource "oci_core_vcn" "test_vcn_a" {
44- // required
7+ // Required
458 cidr_block = " 10.0.0.0/16"
469 compartment_id = var. compartment_ocid
4710
48- // optional
49- display_name = " testVcnA "
11+ // Optional
12+ display_name = " MyTestVcnA "
5013 dns_label = " dnslabelA"
5114}
5215
5316
5417resource "oci_core_vcn" "test_vcn_b" {
55- // required
18+ // Required
5619 cidr_block = " 20.0.0.0/16"
5720 compartment_id = var. compartment_ocid
5821
59- // optional
60- display_name = " testVcnB "
22+ // Optional
23+ display_name = " MyTestVcnB "
6124 dns_label = " dnslabelB"
6225}
6326
6427
65- resource "oci_core_drg" "test_drg " {
66- // required
28+ resource "oci_core_drg" "test_vcn_drg " {
29+ // Required
6730 compartment_id = var. compartment_ocid
6831
69- // optional
70- display_name = " testDrg "
32+ // Optional
33+ display_name = " MyTestVcnDrg "
7134}
7235
73- resource "oci_core_drg_route_distribution" "test_drg_route_distribution " {
74- // required
75- drg_id = oci_core_drg. test_drg . id
36+ resource "oci_core_drg_route_distribution" "test_vcn_drg_route_distribution " {
37+ // Required
38+ drg_id = oci_core_drg. test_vcn_drg . id
7639 distribution_type = " IMPORT"
7740
7841 // optional
79- display_name = " testDrgRouteDistribution "
42+ display_name = " MyTestVcnDrgRouteDistribution "
8043
8144}
8245
83- resource "oci_core_drg_attachment" "test_drg_attachment_a " {
84- // required
85- drg_id = oci_core_drg. test_drg . id
46+ resource "oci_core_drg_attachment" "test_vcn_drg_attachment_a " {
47+ // Required
48+ drg_id = oci_core_drg. test_vcn_drg . id
8649 vcn_id = oci_core_vcn. test_vcn_a . id
8750
51+ // Optional
52+ drg_route_table_id = oci_core_drg_route_table. test_vcn_drg_route_table . id
53+
8854}
8955
90- resource "oci_core_drg_attachment" "test_drg_attachment_b " {
91- // required
92- drg_id = oci_core_drg. test_drg . id
56+ resource "oci_core_drg_attachment" "test_vcn_drg_attachment_b " {
57+ // Required
58+ drg_id = oci_core_drg. test_vcn_drg . id
9359 vcn_id = oci_core_vcn. test_vcn_b . id
9460
61+ // Optional
62+ drg_route_table_id = oci_core_drg_route_table. test_vcn_drg_route_table . id
63+
9564}
9665
97- resource "oci_core_drg_route_distribution_statement" "test_drg_route_distribution_statements " {
98- // required
99- drg_route_distribution_id = oci_core_drg_route_distribution. test_drg_route_distribution . id
66+ resource "oci_core_drg_route_distribution_statement" "test_vcn_drg_route_distribution_statements " {
67+ // Required
68+ drg_route_distribution_id = oci_core_drg_route_distribution. test_vcn_drg_route_distribution . id
10069 action = " ACCEPT"
10170
10271 match_criteria {
@@ -109,19 +78,24 @@ resource "oci_core_drg_route_distribution_statement" "test_drg_route_distributio
10978
11079}
11180
112- data "oci_core_drg_route_distribution" "test_drg_route_distribution_data " {
113- // required
114- drg_route_distribution_id = oci_core_drg_route_distribution. test_drg_route_distribution . id
81+ data "oci_core_drg_route_distribution" "test_vcn_drg_route_distribution_data " {
82+ // Required
83+ drg_route_distribution_id = oci_core_drg_route_distribution. test_vcn_drg_route_distribution . id
11584}
11685
117- resource "oci_core_drg_route_table" "test_drg_route_table" {
118- drg_id = oci_core_drg. test_drg . id
86+ resource "oci_core_drg_route_table" "test_vcn_drg_route_table" {
87+ drg_id = oci_core_drg. test_vcn_drg . id
88+
89+ // Optional
90+ import_drg_route_distribution_id = oci_core_drg_route_distribution. test_vcn_drg_route_distribution . id
91+ display_name = " MyTestVcnDrgRouteTable"
11992}
12093
121- resource "oci_core_drg_route_table_route_rule" "test_drg_route_table_route_rule " {
122- # Required
123- drg_route_table_id = oci_core_drg_route_table. test_drg_route_table . id
94+ resource "oci_core_drg_route_table_route_rule" "test_vcn_drg_route_table_route_rule " {
95+ // Required
96+ drg_route_table_id = oci_core_drg_route_table. test_vcn_drg_route_table . id
12497 destination = " 10.0.0.0/8"
12598 destination_type = " CIDR_BLOCK"
126- next_hop_drg_attachment_id = oci_core_drg_attachment. test_drg_attachment_a . id
99+ next_hop_drg_attachment_id = oci_core_drg_attachment. test_vcn_drg_attachment_a . id
127100}
101+
0 commit comments