1+ // Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+ // Licensed under the Mozilla Public License v2.0
3+
4+ variable "tenancy_ocid" {}
5+ variable "user_ocid" {}
6+ variable "fingerprint" {}
7+ variable "private_key_path" {}
8+ variable "region" {}
9+ variable "compartment_id" {
10+ }
11+
12+ variable "network_firewall_availability_domain" {
13+ default = " "
14+ }
15+
16+ variable "network_firewall_defined_tags_value" {
17+ default = " value"
18+ }
19+
20+ variable "network_firewall_display_name" {
21+ default = " displayName"
22+ }
23+
24+ variable "network_firewall_freeform_tags" {
25+ default = { " bar-key" = " value" }
26+ }
27+
28+ variable "network_firewall_id" {
29+ default = " "
30+ }
31+
32+ variable "network_firewall_ipv4address" {
33+ default = " "
34+ }
35+
36+ variable "network_firewall_ipv6address" {
37+ default = " "
38+ }
39+
40+ variable "network_firewall_network_security_group_ids" {
41+ default = []
42+ }
43+
44+ variable "network_firewall_state" {
45+ default = " "
46+ }
47+
48+ variable "network_firewall_network_firewall_policy_id" {
49+ default = " "
50+ }
51+
52+ data "oci_identity_availability_domain" "ad" {
53+ compartment_id = var. tenancy_ocid
54+ ad_number = 1
55+ }
56+
57+ provider "oci" {
58+ tenancy_ocid = var. tenancy_ocid
59+ user_ocid = var. user_ocid
60+ fingerprint = var. fingerprint
61+ private_key_path = var. private_key_path
62+ region = var. region
63+ }
64+
65+ resource "oci_network_firewall_network_firewall_policy" "test_network_firewall_policy" {
66+ # Required
67+ compartment_id = var. compartment_id
68+ }
69+
70+ resource "oci_network_firewall_network_firewall" "test_network_firewall" {
71+ # Required
72+ compartment_id = var. compartment_id
73+ network_firewall_policy_id = oci_network_firewall_network_firewall_policy. test_network_firewall_policy . id
74+ subnet_id = oci_core_subnet. test_subnet . id
75+
76+ # Optional
77+ availability_domain = data. oci_identity_availability_domain . ad . name
78+ # defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.network_firewall_defined_tags_value)
79+ display_name = var. network_firewall_display_name
80+ freeform_tags = var. network_firewall_freeform_tags
81+ ipv4address = var. network_firewall_ipv4address
82+ ipv6address = var. network_firewall_ipv6address
83+ network_security_group_ids = var. network_firewall_network_security_group_ids
84+ }
85+
86+ resource "oci_core_subnet" "test_subnet" {
87+ availability_domain = data. oci_identity_availability_domain . ad . name
88+ cidr_block = " 10.0.2.0/24"
89+ display_name = " TestSubnet"
90+ dns_label = " testsubnet"
91+ security_list_ids = [oci_core_vcn . vcn1 . default_security_list_id ]
92+ compartment_id = var. compartment_id
93+ vcn_id = oci_core_vcn. vcn1 . id
94+ route_table_id = oci_core_vcn. vcn1 . default_route_table_id
95+ dhcp_options_id = oci_core_vcn. vcn1 . default_dhcp_options_id
96+ }
97+
98+ resource "oci_core_vcn" "vcn1" {
99+ cidr_block = " 10.0.0.0/16"
100+ compartment_id = var. compartment_id
101+ display_name = " firewallVCN"
102+ dns_label = " VcnFw"
103+ }
104+
105+ data "oci_network_firewall_network_firewalls" "test_network_firewalls" {
106+ # Required
107+ compartment_id = var. compartment_id
108+
109+ # Optional
110+ availability_domain = var. network_firewall_availability_domain
111+ display_name = var. network_firewall_display_name
112+ id = var. network_firewall_id
113+ network_firewall_policy_id = oci_network_firewall_network_firewall_policy. test_network_firewall_policy . id
114+ state = var. network_firewall_state
115+ }
0 commit comments