-
Notifications
You must be signed in to change notification settings - Fork 3
/
service-discovery.cfndsl.rb
41 lines (35 loc) · 1.23 KB
/
service-discovery.cfndsl.rb
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
CloudFormation do
raise "config `namespace` must be defined" if !defined? namespace
case type.downcase
when 'private'
ServiceDiscovery_PrivateDnsNamespace(:PrivateDnsNamespace) {
Description FnSub("Private namespace #{namespace} for the ${EnvironmentName} environment")
Name FnSub(namespace)
Vpc Ref(:VPCId)
}
Output(:NamespaceId) {
Value(Ref(:PrivateDnsNamespace))
Export FnSub("${EnvironmentName}-#{component_name}-NamespaceId")
}
when 'public'
ServiceDiscovery_PublicDnsNamespace(:PublicDnsNamespace) {
Description FnSub("Public namespace #{namespace} for the ${EnvironmentName} environment")
Name FnSub(namespace)
}
Output(:NamespaceId) {
Value(Ref(:PublicDnsNamespace))
Export FnSub("${EnvironmentName}-#{component_name}-NamespaceId")
}
when 'http'
ServiceDiscovery_HttpNamespace(:HttpNamespace) {
Description FnSub("HTTP namespace #{namespace} for the ${EnvironmentName} environment")
Name FnSub(namespace)
}
Output(:NamespaceId) {
Value(Ref(:HttpNamespace))
Export FnSub("${EnvironmentName}-#{component_name}-NamespaceId")
}
else
raise "namespace `type` must be one of public | private | http"
end
end