From 4d8ff34e044eb2deddbf3780547862010e609b54 Mon Sep 17 00:00:00 2001 From: Devon Crouse Date: Thu, 10 Nov 2022 16:35:29 -0700 Subject: [PATCH] feat: Support disabled DNS resolution with optional dns_label on VCN (#101) * Support disabled DNS resolution with optional dns_label on VCN Signed-off-by: Devon Crouse * Change vcn_name default from "vcn-module" to "vcn" Signed-off-by: Devon Crouse Signed-off-by: Devon Crouse --- CHANGELOG.adoc | 6 +++++- docs/quickstart.adoc | 4 ++-- docs/terraformoptions.adoc | 6 +++--- examples/custom_route_rules/variables.tf | 2 +- examples/hub-spoke/variables.tf | 2 +- examples/module_composition/variables.tf | 2 +- modules/subnet/subnet.tf | 2 +- schema.yaml | 2 +- variables.tf | 10 +++++----- vcn.tf | 4 ++-- 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1f1cd0d..c3599b4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -15,9 +15,13 @@ Given a version number MAJOR.MINOR.PATCH: - PATCH version when making backwards compatible bug fixes. == 4.0.0 (not released) +* Added support for disabled VCN DNS resolution with null vcn_dns_label variable +* Change default vcn_name from vcn-module -> vcn + +== 3.5.2 (October 7, 2022) * Ignored lifecycle changes for defined_tags, freeform_tags -== 3.5.1 (September 5, 2022)) +== 3.5.1 (September 5, 2022) * removed DRG submodule, now promoted to terraform-oci-drg module (feat: ) * updated examples to use GitHub repo as source () diff --git a/docs/quickstart.adoc b/docs/quickstart.adoc index 81aa6f3..733133b 100644 --- a/docs/quickstart.adoc +++ b/docs/quickstart.adoc @@ -91,7 +91,6 @@ variable "user_id" { * `compartment_id` * `label_prefix` -* `vcn_dns_label` * `vcn_name` . Optional parameters to override: @@ -101,6 +100,7 @@ variable "user_id" { * `create_service_gateway` * `freeform_tags` * `attached_drg_id` +* `vcn_dns_label` . Run Terraform: @@ -160,7 +160,6 @@ cp terraform.tfvars.example terraform.tfvars * `compartment_id` * `label_prefix` -* `vcn_dns_label` * `vcn_name` . Optional parameters to override: @@ -171,6 +170,7 @@ cp terraform.tfvars.example terraform.tfvars * `create_service_gateway` * `freeform_tags` * `defined_tags` +* `vcn_dns_label` . Run Terraform: + diff --git a/docs/terraformoptions.adoc b/docs/terraformoptions.adoc index 777baca..c50ced6 100644 --- a/docs/terraformoptions.adoc +++ b/docs/terraformoptions.adoc @@ -218,14 +218,14 @@ e.g. | `["10.0.0.0/16"]` |`vcn_dns_label` -|A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet +|A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet. DNS resolution for hostnames in the VCN is disabled if null. |`string` |"vcnmodule" |`vcn_name` -|The name of the VCN that will be appended to the label_prefix. *Required* +|The name of the VCN that will be appended to the label_prefix. |`string` -| +|"vcn" |=== diff --git a/examples/custom_route_rules/variables.tf b/examples/custom_route_rules/variables.tf index 6fef1ee..d6cb690 100644 --- a/examples/custom_route_rules/variables.tf +++ b/examples/custom_route_rules/variables.tf @@ -110,7 +110,7 @@ variable "vcn_dns_label" { variable "vcn_name" { description = "user-friendly name of to use for the vcn to be appended to the label_prefix" type = string - default = "vcn-module" + default = "vcn" } # gateways parameters diff --git a/examples/hub-spoke/variables.tf b/examples/hub-spoke/variables.tf index 944e2f1..0264bbd 100644 --- a/examples/hub-spoke/variables.tf +++ b/examples/hub-spoke/variables.tf @@ -109,7 +109,7 @@ variable "vcn_dns_label" { variable "vcn_name" { description = "user-friendly name of to use for the vcn to be appended to the label_prefix" type = string - default = "vcn-module" + default = "vcn" } # gateways parameters diff --git a/examples/module_composition/variables.tf b/examples/module_composition/variables.tf index 2cb1a82..a71e351 100644 --- a/examples/module_composition/variables.tf +++ b/examples/module_composition/variables.tf @@ -109,7 +109,7 @@ variable "vcn_dns_label" { variable "vcn_name" { description = "user-friendly name of to use for the vcn to be appended to the label_prefix" type = string - default = "vcn-module" + default = "vcn" } # gateways parameters diff --git a/modules/subnet/subnet.tf b/modules/subnet/subnet.tf index 8be1354..e19e193 100644 --- a/modules/subnet/subnet.tf +++ b/modules/subnet/subnet.tf @@ -26,7 +26,7 @@ resource "oci_core_subnet" "vcn_subnet" { security_list_ids = null lifecycle { - ignore_changes = [defined_tags, freeform_tags] + ignore_changes = [defined_tags, dns_label, freeform_tags] } } diff --git a/schema.yaml b/schema.yaml index de9bbd7..0b5a202 100644 --- a/schema.yaml +++ b/schema.yaml @@ -46,7 +46,7 @@ variables: vcn_dns_label: title: VCN DNS Label type: string - required: true + required: false default: vcn lockdown_default_seclist: diff --git a/variables.tf b/variables.tf index dad885b..8b57a3e 100644 --- a/variables.tf +++ b/variables.tf @@ -1,4 +1,4 @@ -# Copyright (c) 2019, 2021 Oracle Corporation and/or affiliates. All rights reserved. +# Copyright (c) 2019, 2022 Oracle Corporation and/or affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl # provider identity parameters @@ -83,20 +83,20 @@ variable "vcn_cidrs" { } variable "vcn_dns_label" { - description = "A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet" + description = "A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet. DNS resolution of hostnames in the VCN is disabled when null." type = string default = "vcnmodule" validation { - condition = length(regexall("^[^0-9][a-zA-Z0-9_]+$", var.vcn_dns_label)) > 0 - error_message = "DNS label must be an alphanumeric string that begins with a letter." + condition = var.vcn_dns_label == null ? true : length(regexall("^[^0-9][a-zA-Z0-9_]{1,14}$", var.vcn_dns_label)) > 0 + error_message = "DNS label must be unset to disable, or an alphanumeric string with length of 1 through 15 that begins with a letter." } } variable "vcn_name" { description = "user-friendly name of to use for the vcn to be appended to the label_prefix" type = string - default = "vcn-module" + default = "vcn" validation { condition = length(var.vcn_name) > 0 error_message = "The vcn_name value cannot be an empty string." diff --git a/vcn.tf b/vcn.tf index 18ad13b..9d029c2 100644 --- a/vcn.tf +++ b/vcn.tf @@ -1,4 +1,4 @@ -# Copyright (c) 2019, 2021, Oracle Corporation and/or affiliates. +# Copyright (c) 2019, 2022 Oracle Corporation and/or affiliates. # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ resource "oci_core_vcn" "vcn" { @@ -14,7 +14,7 @@ resource "oci_core_vcn" "vcn" { defined_tags = var.defined_tags lifecycle { - ignore_changes = [defined_tags, freeform_tags] + ignore_changes = [defined_tags, dns_label, freeform_tags] } }