An open API service indexing awesome lists of open source software.

https://github.com/oracle-quickstart/terraform-oci-networking

Terraform module to Quickstart deploy network resources on OCI and to be reused by other projects
https://github.com/oracle-quickstart/terraform-oci-networking

firewall networking oci oracle-cloud-infrastructure remote-peering security terraform terraform-module terraform-modules vcn virtual-cloud-network

Last synced: 2 months ago
JSON representation

Terraform module to Quickstart deploy network resources on OCI and to be reused by other projects

Awesome Lists containing this project

README

        

# Terraform Oracle Cloud Infrastructure ([OCI][oci]) Networking Module

---
> __Warning__

$${\color{red}This \space is \space a \space pre-release \space version \space of \space the \space module, \space some \space features}$$
$${\color{red}have \space not \space been \space migrated \space from \space MuShop's}$$
$${\color{red}OKE \space Cluster \space deployment \space yet.}$$
---

[![Stack Release](https://img.shields.io/github/v/release/oracle-quickstart/terraform-oci-networking.svg)](https://github.com/oracle-quickstart/terraform-oci-networking/releases)
[![Stack Build](https://img.shields.io/github/actions/workflow/status/oracle-quickstart/terraform-oci-networking/stack.yml?branch=main&label=stack&logo=oracle&logoColor=red)][magic_oci_networking_stack]
![AquaSec TFSec](https://img.shields.io/github/actions/workflow/status/oracle-quickstart/terraform-oci-networking/tfsec.yml?branch=main&label=tfsec&logo=aqua)
![Terraform](https://img.shields.io/badge/terraform->%3D%201.1-%235835CC.svg?logo=terraform)
[![Stack License](https://img.shields.io/github/license/oracle-quickstart/terraform-oci-networking)](https://github.com/oracle-quickstart/terraform-oci-networking/tree/main/LICENSE)
![Stack Downloads](https://img.shields.io/github/downloads/oracle-quickstart/terraform-oci-networking/total?logo=terraform)
[![GitHub issues](https://img.shields.io/github/issues/oracle-quickstart/terraform-oci-networking.svg)](https://github.com/oracle-quickstart/terraform-oci-networking/issues)

Terraform module to Quickstart deploy network resources on OCI and to be reused by other projects. This module is designed to be used with the [OCI Resource Manager][oci_rm] to deploy a cluster in a single step. The module can also be used with the [OCI Terraform Provider][oci_tf_provider] to deploy a cluster using local or CloudShell Terraform cli.

## Usage

There are multiple examples included in the [examples](https://github.com/oracle-quickstart/terraform-oci-networking/tree/main/examples) folder but simple usage is as follows:

### Simple module usage

```hcl
module "oci-networking" {
source = "github.com/oracle-quickstart/terraform-oci-networking?ref=0.3.2"

# Oracle Cloud Infrastructure Tenancy and Compartment OCID
tenancy_ocid = var.tenancy_ocid
compartment_ocid = var.compartment_ocid
region = var.region

# Note: Just few arguments are showing here to simplify the basic example. All other arguments are using default values.
# App Name to identify deployment. Used for naming resources.
app_name = "Basic"

# Freeform Tags + Defined Tags. Tags are applied to all resources.
tag_values = { "freeformTags" = { "Environment" = "Development", "DeploymentType" = "basic", "QuickstartExample" = "basic-vcn" }, "definedTags" = {} }

subnets = [
{
subnet_name = "test_subnet"
cidr_block = cidrsubnet("10.0.0.0/16", 8, 35) # e.g.: "10.0.35.0/24" = 254 usable IPs (10.20.35.0 - 10.20.35.255)
display_name = "Test subnet (Basic)"
dns_label = null
prohibit_public_ip_on_vnic = false
prohibit_internet_ingress = false
route_table_id = ""
dhcp_options_id = ""
security_list_ids = []
ipv6cidr_block = null
},
]
}
```

### Separate each module usage

```hcl
module "vcn" {
source = "github.com/oracle-quickstart/terraform-oci-networking//modules/vcn?ref=0.3.2"

# Oracle Cloud Infrastructure Tenancy and Compartment OCID
compartment_ocid = var.compartment_ocid

# Deployment Tags + Freeform Tags + Defined Tags
vcn_tags = local.oci_tag_values

# Virtual Cloud Network (VCN) arguments
create_new_vcn = true
existent_vcn_ocid = ""
cidr_blocks = ["10.0.0.0/16"]
display_name = "[Example] VCN (Dev)"
dns_label = "example123"
is_ipv6enabled = false
ipv6private_cidr_blocks = []
}

module "subnets" {
for_each = { for map in local.subnets : map.subnet_name => map }
source = "github.com/oracle-quickstart/terraform-oci-networking//modules/subnet?ref=0.3.2"

# Oracle Cloud Infrastructure Tenancy and Compartment OCID
compartment_ocid = var.compartment_ocid
vcn_id = module.vcn.vcn_id

# Deployment Tags + Freeform Tags + Defined Tags
subnet_tags = local.oci_tag_values

# Subnet arguments
create_subnet = true
subnet_name = each.value.subnet_name
cidr_block = each.value.cidr_block
display_name = each.value.display_name # If null, is autogenerated
dns_label = each.value.dns_label # If null, is autogenerated
prohibit_public_ip_on_vnic = each.value.prohibit_public_ip_on_vnic
prohibit_internet_ingress = each.value.prohibit_internet_ingress
route_table_id = each.value.route_table_id # If null, the VCN's default route table is used
dhcp_options_id = each.value.dhcp_options_id # If null, the VCN's default set of DHCP options is used
security_list_ids = each.value.security_list_ids # If null, the VCN's default security list is used
ipv6cidr_block = each.value.ipv6cidr_block # If null, no IPv6 CIDR block is assigned
}

locals {
oci_tag_values = {
"freeformTags" = {"CreatedBy" = "Terraform"},
"definedTags" = {}
}
subnets = [
{
subnet_name = "test_subnet"
cidr_block = cidrsubnet("10.0.0.0/16", 8, 35) # e.g.: "10.0.35.0/24" = 254 usable IPs (10.20.35.0 - 10.20.35.255)
display_name = "Test subnet (Dev)"
dns_label = ""
prohibit_public_ip_on_vnic = false
prohibit_internet_ingress = false
route_table_id = "" # module.route_tables["public"].route_table_id
dhcp_options_id = module.vcn.default_dhcp_options_id
security_list_ids = [] # [module.security_lists["test_security_list"].security_list_id]
ipv6cidr_block = null
},
]
}
```

## How is this Terraform Module versioned?

This Terraform Module follows the principles of [Semantic Versioning](http://semver.org/). You can find each new release,
along with the changelog, in the [Releases Page](https://github.com/hashicorp/terraform-google-consul/releases).

During initial development, the major version will be 0 (e.g., `0.x.y`), which indicates the code does not yet have a
stable API. Once we hit `1.0.0`, we will make every effort to maintain a backwards compatible API and use the MAJOR,
MINOR, and PATCH versions on each release to indicate any incompatibilities.

## Questions

If you have an issue or a question, please take a look at our [FAQs](./FAQs.md) or [open an issue](https://github.com/oracle-quickstart/terraform-oci-networking/issues/new).

## Contributing

This project welcomes contributions from the community. Before submitting a pull
request, see [CONTRIBUTING](./CONTRIBUTING.md) for details.

## License

Copyright (c) 2022 Oracle and/or its affiliates.
Released under the Universal Permissive License (UPL), Version 1.0.
See [LICENSE](./LICENSE) for more details.

[oci]: https://cloud.oracle.com/en_US/cloud-infrastructure
[oci_rm]: https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/resourcemanager.htm
[oci_tf_provider]: https://www.terraform.io/docs/providers/oci/index.html
[magic_button]: https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg
[magic_oci_networking_stack]: https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-quickstart/terraform-oci-networking/releases/latest/download/terraform-oci-networking-stack.zip