generated from oracle-quickstart/oci-quickstart-template
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
39 changed files
with
1,071 additions
and
760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_oci"></a> [oci](#provider\_oci) | n/a | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [oci_network_firewall_network_firewall.network_firewall](https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/network_firewall_network_firewall) | resource | | ||
| [oci_network_firewall_network_firewall_policy.network_firewall_policy](https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/network_firewall_network_firewall_policy) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_ip_address_lists"></a> [ip\_address\_lists](#input\_ip\_address\_lists) | The list of ip address. | `map(any)` | n/a | yes | | ||
| <a name="input_network_compartment_ocid"></a> [network\_compartment\_ocid](#input\_network\_compartment\_ocid) | The OCID of the compartment containing the Network Firewall. | `string` | n/a | yes | | ||
| <a name="input_network_firewall_name"></a> [network\_firewall\_name](#input\_network\_firewall\_name) | OCI Network Firewall Name. | `string` | n/a | yes | | ||
| <a name="input_network_firewall_policy_action"></a> [network\_firewall\_policy\_action](#input\_network\_firewall\_policy\_action) | Network Firewall Policy Action. | `string` | n/a | yes | | ||
| <a name="input_network_firewall_policy_name"></a> [network\_firewall\_policy\_name](#input\_network\_firewall\_policy\_name) | The name of network firewall policy. | `string` | n/a | yes | | ||
| <a name="input_network_firewall_subnet_id"></a> [network\_firewall\_subnet\_id](#input\_network\_firewall\_subnet\_id) | The OCID of the subnet associated with the Network Firewall. | `string` | n/a | yes | | ||
| <a name="input_security_rules"></a> [security\_rules](#input\_security\_rules) | The list of security rules. | `map(any)` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_firewall_id"></a> [firewall\_id](#output\_firewall\_id) | The OCID of network firewall | | ||
| <a name="output_firewall_ip"></a> [firewall\_ip](#output\_firewall\_ip) | The IP address network firewall | | ||
| <a name="output_firewall_ip_id"></a> [firewall\_ip\_id](#output\_firewall\_ip\_id) | The OCID of network firewall ip | | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
data "oci_core_private_ips" "firewall_subnet_private_ip" { | ||
subnet_id = var.network_firewall_subnet_id | ||
depends_on = [ | ||
time_sleep.network_firewall_ip_delay | ||
] | ||
|
||
filter { | ||
name = "display_name" | ||
values = [var.network_firewall_name] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
terraform { | ||
required_providers { | ||
oci = { | ||
source = "oracle/oci" | ||
} | ||
} | ||
} | ||
resource "time_sleep" "network_firewall_ip_delay" { | ||
depends_on = [oci_network_firewall_network_firewall.network_firewall] | ||
create_duration = "90s" | ||
} | ||
###################################################################### | ||
# OCI NETWORK FIREWALL # | ||
###################################################################### | ||
resource "oci_network_firewall_network_firewall" "network_firewall" { | ||
compartment_id = var.network_compartment_ocid | ||
network_firewall_policy_id = oci_network_firewall_network_firewall_policy.network_firewall_policy.id | ||
subnet_id = var.network_firewall_subnet_id | ||
display_name = var.network_firewall_name | ||
} | ||
|
||
###################################################################### | ||
# OCI NETWORK FIREWALL POLICY # | ||
###################################################################### | ||
|
||
resource "oci_network_firewall_network_firewall_policy" "network_firewall_policy" { | ||
display_name = var.network_firewall_policy_name | ||
compartment_id = var.network_compartment_ocid | ||
|
||
dynamic "ip_address_lists" { | ||
for_each = var.ip_address_lists | ||
content { | ||
ip_address_list_name = ip_address_lists.key | ||
ip_address_list_value = ip_address_lists.value | ||
} | ||
} | ||
dynamic "security_rules" { | ||
for_each = var.security_rules | ||
content { | ||
name = security_rules.key | ||
action = security_rules.value.security_rules_action | ||
condition { | ||
applications = security_rules.value.security_rules_condition_applications | ||
destinations = security_rules.value.security_rules_condition_destinations | ||
sources = security_rules.value.security_rules_condition_sources | ||
urls = security_rules.value.security_rules_condition_urls | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
output "firewall_id" { | ||
value = oci_network_firewall_network_firewall.network_firewall.id | ||
description = "The OCID of network firewall" | ||
} | ||
|
||
output "firewall_ip_id" { | ||
value = data.oci_core_private_ips.firewall_subnet_private_ip.private_ips[0].id | ||
description = "The OCID of network firewall ip" | ||
} | ||
|
||
output "firewall_ip" { | ||
value = oci_network_firewall_network_firewall.network_firewall.ipv4address | ||
description = "The IP address network firewall" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
variable "network_compartment_ocid" { | ||
type = string | ||
description = "The OCID of the compartment containing the Network Firewall." | ||
} | ||
|
||
variable "network_firewall_name" { | ||
type = string | ||
description = "OCI Network Firewall Name." | ||
} | ||
|
||
variable "network_firewall_subnet_id" { | ||
type = string | ||
description = "The OCID of the subnet associated with the Network Firewall." | ||
} | ||
|
||
variable "network_firewall_policy_name" { | ||
type = string | ||
description = "The name of network firewall policy." | ||
} | ||
|
||
variable "network_firewall_policy_action" { | ||
type = string | ||
description = "Network Firewall Policy Action." | ||
} | ||
variable "ip_address_lists" { | ||
type = map(any) | ||
description = "The list of ip address." | ||
} | ||
variable "security_rules" { | ||
type = map(any) | ||
description = "The list of security rules." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ output "subnets" { | |
} | ||
description = "The subnet OCID" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Support for multi-region deployments | ||
# ----------------------------------------------------------------------------- | ||
###################################################################### | ||
# Support for multi-region deployments # | ||
###################################################################### | ||
locals { | ||
region_subscriptions = data.oci_identity_region_subscriptions.regions.region_subscriptions | ||
home_region = [for region in local.region_subscriptions : region.region_name if region.is_home_region == true] | ||
region_key = [for region in local.region_subscriptions : region.region_key if region.region_name == var.region] | ||
} | ||
|
||
###################################################################### | ||
# Get Tenancy OCID From the Region # | ||
###################################################################### | ||
data "oci_identity_region_subscriptions" "regions" { | ||
tenancy_id = var.tenancy_ocid | ||
} | ||
|
||
###################################################################### | ||
# Get the Private IPs using Trust Subnet # | ||
###################################################################### | ||
data "oci_core_private_ips" "firewall_subnet_private_ip" { | ||
subnet_id = local.public_subnet_id | ||
filter { | ||
name = "display_name" | ||
values = [local.network_firewall_info.network_firewall_name] | ||
} | ||
} |
Oops, something went wrong.