-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patheip.template
141 lines (141 loc) · 3.07 KB
/
eip.template
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
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Nubis EIP stack",
"Parameters": {
"StackName": {
"Description": "Name of the parent stack",
"AllowedPattern": "^[a-zA-Z][a-zA-Z0-9-]{0,254}$",
"ConstraintDescription": "A stack name can contain only alphanumeric characters (case sensitive) and hyphens. It must start with an alphabetic character and cannot be longer than 255 characters.",
"Type": "String"
},
"StacksVersion": {
"Description": "Version of the Nubis Stacks",
"Type": "String",
"Default": "v1.4.0-dev"
},
"IamRole": {
"Description": "Add policies to associate the EIP with the provided IAM role",
"Type": "String",
"Default": ""
}
},
"Conditions": {
"IamRole_Set": {
"Fn::Not": [
{
"Fn::Equals": [
{
"Ref": "IamRole"
},
""
]
}
]
},
"IamRole_NotSet": {
"Fn::Equals": [
{
"Ref": "IamRole"
},
""
]
}
},
"Resources": {
"EIP": {
"Type": "AWS::EC2::EIP"
},
"EIPRole": {
"Type": "AWS::IAM::Role",
"Condition": "IamRole_NotSet",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"Path": "/"
}
},
"EIPRolePolicies": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyName": {
"Fn::Join": [
"-",
[
{
"Ref": "StackName"
},
"eip",
"associate",
"policy"
]
]
},
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:DescribeStacks",
"ec2:AssociateAddress",
"ec2:DisassociateAddress"
],
"Resource": "*"
}
]
},
"Roles": [
{
"Fn::If": [
"IamRole_Set",
{
"Ref": "IamRole"
},
{
"Ref": "EIPRole"
}
]
}
]
}
}
},
"Outputs": {
"EIPAllocationID": {
"Description": "Consul: config/ Elastic IP",
"Value": {
"Fn::GetAtt": [
"EIP",
"AllocationId"
]
}
},
"ElasticIP": {
"Description": "Allocated Elastic IP address",
"Value": {
"Ref": "EIP"
}
},
"IAMRole": {
"Description": "Name of IAM role",
"Condition": "IamRole_NotSet",
"Value": {
"Ref": "EIPRole"
}
}
}
}