From dabecf274efe1ac76a2bdcc2cc12add2170046eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin=20ARDAL?= <6201562+kral2@users.noreply.github.com> Date: Wed, 8 Sep 2021 06:10:26 +0200 Subject: [PATCH] feat: add ipv6 support for VCN (#65) fix #62 --- CHANGELOG.adoc | 5 ++++ docs/terraformoptions.adoc | 5 ++++ examples/custom_route_rules/main.tf | 5 ++-- .../terraform.tfvars.example | 2 ++ examples/custom_route_rules/variables.tf | 18 +++++++---- examples/hub-spoke/README.md | 2 +- examples/hub-spoke/main.tf | 11 +++---- examples/hub-spoke/terraform.tfvars.example | 2 ++ examples/hub-spoke/variables.tf | 18 +++++++---- examples/module_composition/main.tf | 5 ++-- .../terraform.tfvars.example | 2 ++ examples/module_composition/variables.tf | 18 +++++++---- terraform.tfvars.example | 2 ++ variables.tf | 30 +++++++++++-------- vcn.tf | 1 + 15 files changed, 86 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a7df592..9074534 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -14,6 +14,11 @@ Given a version number MAJOR.MINOR.PATCH: - MINOR version when adding functionality in a backwards compatible manner, - PATCH version when making backwards compatible bug fixes. +== v3.1.0 (Unreleased) + +=== New features +* Added add IPv6 support for VCN (fixes #62) + == v3.0.0 (September 03, 2021) === Breaking changes diff --git a/docs/terraformoptions.adoc b/docs/terraformoptions.adoc index 2887d4b..8d1a880 100644 --- a/docs/terraformoptions.adoc +++ b/docs/terraformoptions.adoc @@ -85,6 +85,11 @@ |`string` |"drg" +|`enable_ipv6` +|(Updatable) Whether IPv6 is enabled for the VCN. If enabled, Oracle will assign the VCN a IPv6 /56 CIDR block. +|`boolean` +|false + |`freeform_tags` |simple key-value pairs to tag the resources created specified in the form of a map |`map(any)` diff --git a/examples/custom_route_rules/main.tf b/examples/custom_route_rules/main.tf index 822f150..fc780b8 100644 --- a/examples/custom_route_rules/main.tf +++ b/examples/custom_route_rules/main.tf @@ -17,7 +17,7 @@ terraform { module "vcn" { source = "oracle-terraform-modules/vcn/oci" - version = "3.0.0" + version = "3.1.0" # general oci parameters compartment_id = var.compartment_id @@ -30,7 +30,8 @@ module "vcn" { lockdown_default_seclist = var.lockdown_default_seclist # boolean: true or false create_nat_gateway = var.create_nat_gateway # boolean: true or false create_service_gateway = var.create_service_gateway # boolean: true or false - vcn_cidrs = var.vcn_cidrs # List of IPv4 CIDRs + enable_ipv6 = var.enable_ipv6 + vcn_cidrs = var.vcn_cidrs # List of IPv4 CIDRs vcn_dns_label = var.vcn_dns_label vcn_name = var.vcn_name diff --git a/examples/custom_route_rules/terraform.tfvars.example b/examples/custom_route_rules/terraform.tfvars.example index 9c0d870..432e71f 100644 --- a/examples/custom_route_rules/terraform.tfvars.example +++ b/examples/custom_route_rules/terraform.tfvars.example @@ -29,6 +29,8 @@ create_nat_gateway = false create_service_gateway = false +enable_ipv6 = false + vcn_cidrs = ["10.0.0.0/16"] vcn_dns_label = "vcn" diff --git a/examples/custom_route_rules/variables.tf b/examples/custom_route_rules/variables.tf index 39fe8d8..998b030 100644 --- a/examples/custom_route_rules/variables.tf +++ b/examples/custom_route_rules/variables.tf @@ -61,12 +61,6 @@ variable "create_internet_gateway" { default = true } -variable "lockdown_default_seclist" { - description = "whether to remove all default security rules from the VCN Default Security List" - type = bool - default = true -} - variable "create_nat_gateway" { description = "whether to create a nat gateway in the vcn" type = bool @@ -79,6 +73,12 @@ variable "create_service_gateway" { default = true } +variable "enable_ipv6" { + description = "Whether IPv6 is enabled for the VCN. If enabled, Oracle will assign the VCN a IPv6 /56 CIDR block." + type = bool + default = false +} + variable "freeform_tags" { description = "simple key-value pairs to tag the resources created" type = map(any) @@ -88,6 +88,12 @@ variable "freeform_tags" { } } +variable "lockdown_default_seclist" { + description = "whether to remove all default security rules from the VCN Default Security List" + type = bool + default = true +} + variable "vcn_cidrs" { description = "The list of IPv4 CIDR blocks the VCN will use." type = list(string) diff --git a/examples/hub-spoke/README.md b/examples/hub-spoke/README.md index cdd5739..56342b9 100644 --- a/examples/hub-spoke/README.md +++ b/examples/hub-spoke/README.md @@ -21,7 +21,7 @@ Three VCN will be created: This diagram illustrates what will be created by this example. -![diagram](https://github.com/oracle-terraform-modules/terraform-oci-vcn/blob/main/docs/images/hub-spoke-lpg.PNG?raw=true&sanitize=true) +![diagram](https://github.com/oracle-terraform-modules/terraform-oci-vcn/blob/main/docs/images/hub-spoke-lpg.png?raw=true&sanitize=true) ## How to declare one or many LPG on the vcn module diff --git a/examples/hub-spoke/main.tf b/examples/hub-spoke/main.tf index 5cfa335..4b671f8 100644 --- a/examples/hub-spoke/main.tf +++ b/examples/hub-spoke/main.tf @@ -18,7 +18,7 @@ terraform { module "vcn_hub" { # this module use the generic vcn module and configure it to act as a hub in a hub-and-spoke topology source = "oracle-terraform-modules/vcn/oci" - version = "3.0.0" + version = "3.1.0" # general oci parameters compartment_id = var.compartment_id @@ -31,7 +31,8 @@ module "vcn_hub" { lockdown_default_seclist = var.lockdown_default_seclist # boolean: true or false create_nat_gateway = var.create_nat_gateway # boolean: true or false create_service_gateway = var.create_service_gateway # boolean: true or false - vcn_cidrs = var.vcn_cidrs # List of IPv4 CIDRs + enable_ipv6 = var.enable_ipv6 + vcn_cidrs = var.vcn_cidrs # List of IPv4 CIDRs vcn_dns_label = var.vcn_dns_label vcn_name = var.vcn_name @@ -67,7 +68,7 @@ resource "oci_core_route_table" "VTR_spokes" { module "vcn_spoke1" { # this module use the generic vcn module and configure it to act as a spoke in a hub-and-spoke topology source = "oracle-terraform-modules/vcn/oci" - version = "3.0.0" + version = "3.1.0" # general oci parameters compartment_id = var.compartment_id @@ -96,7 +97,7 @@ module "vcn_spoke1" { module "vcn_spoke2" { # this module use the generic vcn module and configure it to act as a spoke in a hub-and-spoke topology source = "oracle-terraform-modules/vcn/oci" - version = "3.0.0" + version = "3.1.0" # general oci parameters compartment_id = var.compartment_id @@ -123,7 +124,7 @@ module "vcn_spoke2" { module "vcn_spoke3" { # this module use the generic vcn module and configure it to act as a spoke in a hub-and-spoke topology source = "oracle-terraform-modules/vcn/oci" - version = "3.0.0" + version = "3.1.0" # general oci parameters compartment_id = var.compartment_id diff --git a/examples/hub-spoke/terraform.tfvars.example b/examples/hub-spoke/terraform.tfvars.example index 09e88ee..1ec11de 100644 --- a/examples/hub-spoke/terraform.tfvars.example +++ b/examples/hub-spoke/terraform.tfvars.example @@ -29,6 +29,8 @@ create_nat_gateway = false create_service_gateway = false +enable_ipv6 = false + vcn_cidrs = ["10.0.0.0/24"] vcn_dns_label = "vcn" diff --git a/examples/hub-spoke/variables.tf b/examples/hub-spoke/variables.tf index 23a01ab..f736bb4 100644 --- a/examples/hub-spoke/variables.tf +++ b/examples/hub-spoke/variables.tf @@ -61,12 +61,6 @@ variable "create_internet_gateway" { default = false } -variable "lockdown_default_seclist" { - description = "whether to remove all default security rules from the VCN Default Security List" - type = bool - default = true -} - variable "create_nat_gateway" { description = "whether to create a nat gateway in the vcn" type = bool @@ -79,6 +73,18 @@ variable "create_service_gateway" { default = false } +variable "lockdown_default_seclist" { + description = "whether to remove all default security rules from the VCN Default Security List" + type = bool + default = true +} + +variable "enable_ipv6" { + description = "Whether IPv6 is enabled for the VCN. If enabled, Oracle will assign the VCN a IPv6 /56 CIDR block." + type = bool + default = true +} + variable "freeform_tags" { description = "simple key-value pairs to tag the resources created" type = map(any) diff --git a/examples/module_composition/main.tf b/examples/module_composition/main.tf index 2c8fc9f..0b5d8d8 100644 --- a/examples/module_composition/main.tf +++ b/examples/module_composition/main.tf @@ -17,7 +17,7 @@ terraform { module "vcn" { source = "oracle-terraform-modules/vcn/oci" - version = "3.0.0" + version = "3.1.0" # general oci parameters compartment_id = var.compartment_id @@ -30,7 +30,8 @@ module "vcn" { lockdown_default_seclist = var.lockdown_default_seclist # boolean: true or false create_nat_gateway = var.create_nat_gateway # boolean: true or false create_service_gateway = var.create_service_gateway # boolean: true or false - vcn_cidrs = var.vcn_cidrs # List of IPv4 CIDRs + enable_ipv6 = var.enable_ipv6 + vcn_cidrs = var.vcn_cidrs # List of IPv4 CIDRs vcn_dns_label = var.vcn_dns_label vcn_name = var.vcn_name diff --git a/examples/module_composition/terraform.tfvars.example b/examples/module_composition/terraform.tfvars.example index feb5315..57893af 100644 --- a/examples/module_composition/terraform.tfvars.example +++ b/examples/module_composition/terraform.tfvars.example @@ -29,6 +29,8 @@ create_nat_gateway = false create_service_gateway = false +enable_ipv6 = false + vcn_cidrs = ["10.0.0.0/16", "172.16.0.0/16", "192.168.0.0/24"] vcn_dns_label = "vcn" diff --git a/examples/module_composition/variables.tf b/examples/module_composition/variables.tf index b159ee0..af71fb8 100644 --- a/examples/module_composition/variables.tf +++ b/examples/module_composition/variables.tf @@ -61,12 +61,6 @@ variable "create_internet_gateway" { default = false } -variable "lockdown_default_seclist" { - description = "whether to remove all default security rules from the VCN Default Security List" - type = bool - default = false -} - variable "create_nat_gateway" { description = "whether to create a nat gateway in the vcn" type = bool @@ -79,6 +73,12 @@ variable "create_service_gateway" { default = false } +variable "enable_ipv6" { + description = "Whether IPv6 is enabled for the VCN. If enabled, Oracle will assign the VCN a IPv6 /56 CIDR block." + type = bool + default = false +} + variable "freeform_tags" { description = "simple key-value pairs to tag the resources created" type = map(any) @@ -88,6 +88,12 @@ variable "freeform_tags" { } } +variable "lockdown_default_seclist" { + description = "whether to remove all default security rules from the VCN Default Security List" + type = bool + default = false +} + variable "vcn_cidrs" { description = "The list of IPv4 CIDR blocks the VCN will use." type = list(string) diff --git a/terraform.tfvars.example b/terraform.tfvars.example index 9f4c69c..c37d762 100644 --- a/terraform.tfvars.example +++ b/terraform.tfvars.example @@ -16,6 +16,8 @@ create_internet_gateway = false create_nat_gateway = false +enable_ipv6 = false + nat_gateway_public_ip_id = "none" create_service_gateway = false diff --git a/variables.tf b/variables.tf index e10cd6b..3747f0d 100644 --- a/variables.tf +++ b/variables.tf @@ -47,6 +47,24 @@ variable "create_internet_gateway" { type = bool } +variable "create_nat_gateway" { + description = "whether to create a nat gateway in the vcn. If set to true, creates a nat gateway." + default = false + type = bool +} + +variable "create_service_gateway" { + description = "whether to create a service gateway. If set to true, creates a service gateway." + default = false + type = bool +} + +variable "enable_ipv6" { + description = "Whether IPv6 is enabled for the VCN. If enabled, Oracle will assign the VCN a IPv6 /56 CIDR block." + type = bool + default = false +} + variable "local_peering_gateways" { description = "Map of Local Peering Gateways to attach to the VCN." type = map(any) @@ -59,24 +77,12 @@ variable "lockdown_default_seclist" { type = bool } -variable "create_nat_gateway" { - description = "whether to create a nat gateway in the vcn. If set to true, creates a nat gateway." - default = false - type = bool -} - variable "nat_gateway_public_ip_id" { description = "OCID of reserved IP address for NAT gateway. The reserved public IP address needs to be manually created." default = "none" type = string } -variable "create_service_gateway" { - description = "whether to create a service gateway. If set to true, creates a service gateway." - default = false - type = bool -} - variable "vcn_cidrs" { description = "The list of IPv4 CIDR blocks the VCN will use." default = ["10.0.0.0/16"] diff --git a/vcn.tf b/vcn.tf index 66213f2..505b52c 100644 --- a/vcn.tf +++ b/vcn.tf @@ -8,6 +8,7 @@ resource "oci_core_vcn" "vcn" { compartment_id = var.compartment_id display_name = var.label_prefix == "none" ? var.vcn_name : "${var.label_prefix}-${var.vcn_name}" dns_label = var.vcn_dns_label + is_ipv6enabled = var.enable_ipv6 freeform_tags = var.freeform_tags }