diff --git a/data/stacks/common.yaml b/data/stacks/common.yaml index 94e37ad..6955851 100644 --- a/data/stacks/common.yaml +++ b/data/stacks/common.yaml @@ -3,6 +3,7 @@ ## Basic example examples::basic::vars: + domain_name: 'basic.example' region: 'us-east-2' stack_item_fullname: 'Basic Examples' stack_item_label: 'bsc' diff --git a/dhcp/main.tf b/dhcp/main.tf index 5d3312f..382000b 100644 --- a/dhcp/main.tf +++ b/dhcp/main.tf @@ -1,12 +1,17 @@ # DHCP Options +## Set Terraform version constraint +terraform { + required_version = "> 0.8.0" +} + ## Provisions DHCP options resource "aws_vpc_dhcp_options" "dhcp" { domain_name = "${var.domain_name}" - domain_name_servers = ["${var.name_servers}"] - netbios_name_servers = ["${var.netbios_name_servers}"] + domain_name_servers = ["${compact(var.name_servers)}"] + netbios_name_servers = ["${compact(var.netbios_name_servers)}"] netbios_node_type = "${var.netbios_node_type}" - ntp_servers = ["${var.ntp_servers}"] + ntp_servers = ["${compact(var.ntp_servers)}"] tags { application = "${var.stack_item_fullname}" diff --git a/dhcp/variables.tf b/dhcp/variables.tf index ba02bb5..6eec3ce 100644 --- a/dhcp/variables.tf +++ b/dhcp/variables.tf @@ -21,29 +21,29 @@ variable "vpc_id" { variable "domain_name" { type = "string" description = "The suffix domain name to use by default when resolving non Fully Qualified Domain Names" - default = "service.consul" + default = "" } variable "name_servers" { type = "list" description = "List of name servers to configure in '/etc/resolv.conf'" - default = ["127.0.0.1"] + default = ["AmazonProvidedDNS"] } variable "netbios_name_servers" { type = "list" description = "List of NETBIOS name servers" - default = ["127.0.0.1"] + default = [] } variable "netbios_node_type" { type = "string" description = "The NetBIOS node type (1, 2, 4, or 8). AWS recommends to specify 2 since broadcast and multicast are not supported in their network." - default = "2" + default = "" } variable "ntp_servers" { type = "list" description = "List of NTP servers to configure" - default = ["127.0.0.1"] + default = [] } diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 266d9b7..14550bd 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -18,6 +18,18 @@ module "vpc_base" { vpc_cidr = "${var.vpc_cidr}" } +## Configures DHCP +module "vpc_dhcp" { + # Example GitHub source + #source = "github.com/unifio/terraform-aws-vpc?ref=master//dhcp" + source = "../../dhcp" + + domain_name = "${var.domain_name}" + stack_item_fullname = "${var.stack_item_fullname}" + stack_item_label = "${var.stack_item_label}" + vpc_id = "${module.vpc_base.vpc_id}" +} + ## Configures VPC Availabilty Zones module "vpc_az" { # Example GitHub source diff --git a/examples/basic/variables.tf b/examples/basic/variables.tf index 0ef624d..9aa7cbb 100644 --- a/examples/basic/variables.tf +++ b/examples/basic/variables.tf @@ -28,6 +28,12 @@ variable "vpc_cidr" { type = "string" } +## DHCP +variable "domain_name" { + type = "string" + default = "" +} + ## AZ parameters variable "azs_provisioned" { type = "string"