Skip to content

Commit

Permalink
Merge pull request #21 from Guslington/dns
Browse files Browse the repository at this point in the history
refactor dns naming config
  • Loading branch information
Guslington authored May 30, 2019
2 parents c681851 + 5924f4e commit 064905d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 5 additions & 9 deletions vpc.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@
Tags vpc_tags
end

dns_domain = FnJoin('.', [
Ref('EnvironmentName'), Ref('DnsDomain')
])

unless manage_ns_records
Route53_HostedZone('HostedZone') do
Name dns_domain
Name FnSub(dns_format)
HostedZoneConfig ({
Comment: FnSub("Hosted Zone for ${EnvironmentName}")
})
Expand All @@ -54,7 +50,7 @@
end

EC2_DHCPOptions('DHCPOptionSet') do
DomainName dns_domain
DomainName FnSub(dns_format)
DomainNameServers ['AmazonProvidedDNS']
end

Expand Down Expand Up @@ -299,7 +295,7 @@

if defined?(flowlogs)
log_retention = (flowlogs.is_a?(Hash) && flowlogs.has_key?('log_retention')) ? flowlogs['log_retention'] : 7


Resource('FlowLogsLogGroup') {
Type 'AWS::Logs::LogGroup'
Expand All @@ -314,7 +310,7 @@
Statement: [
{
Effect: 'Allow',
Principal: {
Principal: {
Service: 'vpc-flow-logs.amazonaws.com'
},
Action: [ 'sts:AssumeRole' ]
Expand All @@ -341,7 +337,7 @@
}
])
end


EC2_FlowLog("VPCFlowLogs") do
DeliverLogsPermissionArn FnGetAtt('PutVPCFlowLogsRole', 'Arn')
Expand Down
4 changes: 4 additions & 0 deletions vpc.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ enable_transit_vpc: false
manage_ns_records: false
#is false by default for backward compatibilty

# Set the string to format the Fn::Sub HostedZone
dns_format: ${EnvironmentName}.${DnsDomain}

#
# NACL Rules
#
Expand Down Expand Up @@ -170,6 +173,7 @@ managed_accounts:
config_export:
global:
- maximum_availability_zones
- dns_format

lib_export:
global:
Expand Down

0 comments on commit 064905d

Please sign in to comment.