Commit 85a47cb3 authored by brian cenker's avatar brian cenker Committed by Anton Babenko

Add support for DHCP options set (#20)

* Add support for DHCP options set

* code cleanup

* remove unnecessary depends_on in aws_vpc_dhcp_options_association definition
parent 9bc48445
......@@ -15,6 +15,7 @@ These types of resources are supported:
* [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html) (S3 and DynamoDB)
* [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)
* [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)
* [DHCP Options Set](https://www.terraform.io/docs/providers/aws/r/vpc_dhcp_options.html)
Usage
-----
......
......@@ -19,6 +19,10 @@ module "vpc" {
enable_s3_endpoint = true
enable_dynamodb_endpoint = true
enable_dhcp_options = true
dhcp_options_domain_name = "service.consul"
dhcp_options_domain_name_servers = ["127.0.0.1", "10.10.0.2"]
tags = {
Owner = "user"
Environment = "staging"
......
......@@ -10,6 +10,29 @@ resource "aws_vpc" "this" {
tags = "${merge(var.tags, map("Name", format("%s", var.name)))}"
}
###################
# DHCP Options Set
###################
resource "aws_vpc_dhcp_options" "this" {
count = "${var.enable_dhcp_options ? 1 : 0}"
domain_name = "${var.dhcp_options_domain_name}"
domain_name_servers = "${var.dhcp_options_domain_name_servers}"
ntp_servers = "${var.dhcp_options_ntp_servers}"
netbios_name_servers = "${var.dhcp_options_netbios_name_servers}"
netbios_node_type = "${var.dhcp_options_netbios_node_type}"
}
###############################
# DHCP Options Set Association
###############################
resource "aws_vpc_dhcp_options_association" "this" {
count = "${var.enable_dhcp_options ? 1 : 0}"
vpc_id = "${aws_vpc.this.id}"
dhcp_options_id = "${aws_vpc_dhcp_options.this.id}"
}
###################
# Internet Gateway
###################
......
......@@ -129,3 +129,36 @@ variable "elasticache_subnet_tags" {
description = "Additional tags for the elasticache subnets"
default = {}
}
variable "enable_dhcp_options" {
description = "Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type"
default = false
}
variable "dhcp_options_domain_name" {
description = "Specifies DNS name for DHCP options set"
default = ""
}
variable "dhcp_options_domain_name_servers" {
description = "Specify a list of DNS server addresses for DHCP options set, default to AWS provided"
type = "list"
default = ["AmazonProvidedDNS"]
}
variable "dhcp_options_ntp_servers" {
description = "Specify a list of NTP servers for DHCP options set"
type = "list"
default = []
}
variable "dhcp_options_netbios_name_servers" {
description = "Specify a list of netbios servers for DHCP options set"
type = "list"
default = []
}
variable "dhcp_options_netbios_node_type" {
description = "Specify netbios node_type for DHCP options set"
default = ""
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment