Skip to content

Commit

Permalink
Merge pull request #28 from unifio/kj-enable-variable-dhcp
Browse files Browse the repository at this point in the history
Add enable flag for dhcp to conditionally add resources
  • Loading branch information
kjonick1 authored Nov 14, 2017
2 parents fd3c29d + 8acdfed commit 85ca404
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#### Consider Implementing:
* ipv6 support

## 0.3.3 (November 13, 2017)

#### IMPROVEMENTS / NEW FEATURES:
* Add 'enable' flag for DHCP. Default is true. This allows for stacks to include these based on variable since at this time you cannot conditionally include modules.

## 0.3.2 (May 16, 2017)

#### BACKWARDS INCOMPATIBILITIES / NOTES:
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'rake'
require 'covalence/environment_tasks'
require 'covalence/packer_tasks'
require 'covalence/spec_tasks'
4 changes: 4 additions & 0 deletions dhcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ terraform {

## Provisions DHCP options
resource "aws_vpc_dhcp_options" "dhcp" {
count = "${var.enable == "true" ? "1" : "0"}"

domain_name = "${var.domain_name}"
domain_name_servers = ["${compact(var.name_servers)}"]
netbios_name_servers = ["${compact(var.netbios_name_servers)}"]
Expand All @@ -21,6 +23,8 @@ resource "aws_vpc_dhcp_options" "dhcp" {
}

resource "aws_vpc_dhcp_options_association" "dns_resolver" {
count = "${var.enable == "true" ? "1" : "0"}"

dhcp_options_id = "${aws_vpc_dhcp_options.dhcp.id}"
vpc_id = "${var.vpc_id}"
}
6 changes: 6 additions & 0 deletions dhcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ variable "domain_name" {
default = ""
}

variable "enable" {
type = "string"
description = "Determine if resources should be added. Used if you want to include conditionally in a module."
default = "true"
}

variable "name_servers" {
type = "list"
description = "List of name servers to configure in '/etc/resolv.conf'"
Expand Down

0 comments on commit 85ca404

Please sign in to comment.