-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprivate-zone.yaml
185 lines (178 loc) · 4.31 KB
/
private-zone.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#
# Copyright 2018 Eonian Technologies.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
AWSTemplateFormatVersion: '2010-09-09'
Description: Private hosted zone with associated VPCs.
# Parameters
# NOTE: The CIDRs of the associated VPCs must not overlap.
Parameters:
Name:
Type: String
Description: The domain name of the hosted zone. E.g., mycompany.net
Comment:
Type: String
Description: Optional comments. E.g., Internal Only
VPC1Id:
Type: String
Description: The ID of the frist VPC.
VPC1Region:
Type: String
Description: The region of the first VPC.
VPC2Id:
Type: String
Description: The ID of the second VPC.
VPC2Region:
Type: String
Description: The region of the second VPC.
VPC3Id:
Type: String
Description: The ID of the third VPC.
VPC3Region:
Type: String
Description: The region of the third VPC.
VPC4Id:
Type: String
Description: The ID of the fourth VPC.
VPC4Region:
Type: String
Description: The region of the fourth VPC.
VPC5Id:
Type: String
Description: The ID of the fifth VPC.
VPC5Region:
Type: String
Description: The region of the fifth VPC.
# Conditions
Conditions:
HasSecondVPC: !And [
!Not [!Equals ['', !Ref VPC2Id]],
!Not [!Equals ['', !Ref VPC2Region]]]
HasThirdVPC: !And [
!Not [!Equals ['', !Ref VPC3Id]],
!Not [!Equals ['', !Ref VPC3Region]]]
HasFourthVPC: !And [
!Not [!Equals ['', !Ref VPC4Id]],
!Not [!Equals ['', !Ref VPC4Region]]]
HasFifthVPC: !And [
!Not [!Equals ['', !Ref VPC5Id]],
!Not [!Equals ['', !Ref VPC5Region]]]
# Metadata
Metadata:
AWS::CloudFormation::Interface:
# Parameter Groups
ParameterGroups:
- Label:
default: Hosted Zone
Parameters:
- Name
- Comment
- Label:
default: First VPC
Parameters:
- VPC1Id
- VPC1Region
- Label:
default: Second VPC (optional)
Parameters:
- VPC2Id
- VPC2Region
- Label:
default: Third VPC (optional)
Parameters:
- VPC3Id
- VPC3Region
- Label:
default: Fourth VPC (optional)
Parameters:
- VPC4Id
- VPC4Region
- Label:
default: Fith VPC (optional)
Parameters:
- VPC5Id
- VPC5Region
# Parameter Labels
ParameterLabels:
Name:
default: Domain Name
VPC1Id:
default: VPC Id
VPC1Region:
default: Region
VPC2Id:
default: VPC Id
VPC2Region:
default: Region
VPC3Id:
default: VPC Id
VPC3Region:
default: Region
VPC4Id:
default: VPC Id
VPC4Region:
default: Region
VPC5Id:
default: VPC Id
VPC5Region:
default: Region
# Resrouces
Resources:
HostedZone:
Type: "AWS::Route53::HostedZone"
Properties:
Name: !Ref Name
HostedZoneConfig:
Comment: !Ref Comment
VPCs:
- VPCId: !Ref VPC1Id
VPCRegion: !Ref VPC1Region
- Fn::If:
- HasSecondVPC
- VPCId:
Ref: VPC2Id
VPCRegion:
Ref: VPC2Region
- Ref: AWS::NoValue
- Fn::If:
- HasThirdVPC
- VPCId:
Ref: VPC3Id
VPCRegion:
Ref: VPC3Region
- Ref: AWS::NoValue
- Fn::If:
- HasFourthVPC
- VPCId:
Ref: VPC4Id
VPCRegion:
Ref: VPC4Region
- Ref: AWS::NoValue
- Fn::If:
- HasFifthVPC
- VPCId:
Ref: VPC5Id
VPCRegion:
Ref: VPC5Region
- Ref: AWS::NoValue
# Outputs
Outputs:
HostedZoneId:
Description: The hosted zone
Value:
Ref: HostedZone
Export:
Name:
Fn::Sub:
${AWS::StackName}:hosted-zone-id