Skip to content

add enable_aws_dns #1

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
* v1.0.5 -- 20210531
- peer
- setup peer

* v1.1.0 -- 20210625
- vpc
- add enable_aws_dns to use the AmazonDNS Route53 DNS
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "1.0.5"
_module_version = "1.1.0"
}
2 changes: 2 additions & 0 deletions vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module "vpc" {
# optional
enable_dns_support = true
enable_dns_hostnames = true
enable_aws_dns = false
tags = {}
}
Expand Down Expand Up @@ -58,6 +59,7 @@ No modules.
|------|-------------|------|---------|:--------:|
| <a name="input_account_alias"></a> [account\_alias](#input\_account\_alias) | AWS Account Alias | `string` | `""` | no |
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account ID (default will pull from current user) | `string` | `""` | no |
| <a name="input_enable_aws_dns"></a> [enable\_aws\_dns](#input\_enable\_aws\_dns) | Enable use of AWS DNS server. This overrides the settings of vpc\_dns\_servers and enables dns\_support and dns\_hostnames | `bool` | `false` | no |
| <a name="input_enable_dns_hostnames"></a> [enable\_dns\_hostnames](#input\_enable\_dns\_hostnames) | Enable DNS hostnames within the VPC | `bool` | `true` | no |
| <a name="input_enable_dns_support"></a> [enable\_dns\_support](#input\_enable\_dns\_support) | Enable DNS support within the VPC | `bool` | `true` | no |
| <a name="input_network_census"></a> [network\_census](#input\_network\_census) | Census Subnets | `list` | <pre>[<br> "148.129.0.0/16",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
Expand Down
12 changes: 9 additions & 3 deletions vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* # optional
* enable_dns_support = true
* enable_dns_hostnames = true
* enable_aws_dns = false
*
* tags = {}
* }
Expand All @@ -35,14 +36,19 @@ locals {
"boc:tf_module_version" = local._module_version
"boc:created_by" = "terraform"
}

enable_dns_support = var.enable_aws_dns ? true : var.enable_dns_support
enable_dns_hostnames = var.enable_aws_dns ? true : var.enable_dns_hostnames
vpc_dns_servers = var.enable_aws_dns ? "AmazonDNS" : var.vpc_dns_servers

}

#---
# dhcp options
#---
resource "aws_vpc_dhcp_options" "vpc" {
domain_name = var.vpc_domain_name != "" ? var.vpc_domain_name : "unknown.census.gov"
domain_name_servers = var.vpc_dns_servers
domain_name_servers = local.vpc_dns_servers
ntp_servers = var.vpc_ntp_servers

tags = merge(
Expand All @@ -62,8 +68,8 @@ resource "aws_vpc_dhcp_options_association" "vpc" {
#---
resource "aws_vpc" "vpc" {
cidr_block = var.vpc_cidr_block
enable_dns_support = true
enable_dns_hostnames = true
enable_dns_support = local.enable_dns_support
enable_dns_hostnames = local.enable_dns_hostnames

tags = merge(
local.base_tags,
Expand Down
6 changes: 6 additions & 0 deletions vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "enable_dns_hostnames" {
default = true
}

variable "enable_aws_dns" {
description = "Enable use of AWS DNS server. This overrides the settings of vpc_dns_servers and enables dns_support and dns_hostnames"
type = bool
default = false
}

###
##
## variable "vpc_domain_name" {
Expand Down