cloudformation-ruby-dsl 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5160b62e070108409db1f685692e0158efece837
|
4
|
+
data.tar.gz: 2b06be14903bd5f45f1e2fcb2be5a452ce24560a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50eb7c54962bfc80b276941da6c58859ecc57a64ad5149d2be357e2591009f90ce334e19c2cbf2673365c3b48ff1a70afdcc1bf947fa0a665f5b8ababb38edff
|
7
|
+
data.tar.gz: 2da8a50dc1de0440c92505aae6a2bab993e0517568d5c5806fa89e392721b534f62a7e9161c0e0262c16fc9e67e7c3654d7d5bfbf99392e202dcccb8c373366d
|
data/README.md
CHANGED
@@ -94,6 +94,8 @@ Invoke an intrinsic CloudFormation function.
|
|
94
94
|
- `select(index, list)`
|
95
95
|
- `ref(name)`
|
96
96
|
- `import_value(value)`
|
97
|
+
- `sub(sub_string)`
|
98
|
+
- `sub(sub_string, var_map)`
|
97
99
|
|
98
100
|
Intrinsic conditionals are also supported, with some syntactic sugar.
|
99
101
|
- `fn_not(condition)`
|
@@ -23,7 +23,7 @@ require 'cloudformation-ruby-dsl/table'
|
|
23
23
|
|
24
24
|
template do
|
25
25
|
|
26
|
-
# Metadata may be embedded into the stack, as per http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
|
26
|
+
# Metadata may be embedded into the stack, as per http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
|
27
27
|
# The below definition produces CloudFormation interface metadata.
|
28
28
|
metadata 'AWS::CloudFormation::Interface', {
|
29
29
|
:ParameterGroups => [
|
@@ -35,7 +35,7 @@ template do
|
|
35
35
|
:Label => { :default => 'Other options' },
|
36
36
|
:Parameters => [ 'Label', 'EmailAddress' ]
|
37
37
|
}
|
38
|
-
],
|
38
|
+
],
|
39
39
|
:ParameterLabels => {
|
40
40
|
:EmailAddress => {
|
41
41
|
:default => "We value your privacy!"
|
@@ -79,6 +79,10 @@ template do
|
|
79
79
|
:Type => 'String',
|
80
80
|
:Description => 'Email address at which to send notification events.'
|
81
81
|
|
82
|
+
parameter 'BucketName',
|
83
|
+
:Type => 'String',
|
84
|
+
:Description => 'Name of the bucket to upload to.'
|
85
|
+
|
82
86
|
mapping 'InlineExampleMap',
|
83
87
|
:team1 => {
|
84
88
|
:name => 'test1',
|
@@ -134,7 +138,7 @@ template do
|
|
134
138
|
# These tags are excised from the template and used to generate a series of --tag arguments
|
135
139
|
# which are passed to CloudFormation when a stack is created.
|
136
140
|
# They do not ultimately appear in the expanded CloudFormation template.
|
137
|
-
# The diff subcommand will compare tags with the running stack and identify any changes,
|
141
|
+
# The diff subcommand will compare tags with the running stack and identify any changes,
|
138
142
|
# but a stack update will do the diff and throw an error on any immutable tags update attempt.
|
139
143
|
# The tags are propagated to all resources created by the stack, including the stack itself.
|
140
144
|
# If a resource has its own tag with the same name as CF's it's not overwritten.
|
@@ -238,6 +242,24 @@ template do
|
|
238
242
|
:Path => '/',
|
239
243
|
}
|
240
244
|
|
245
|
+
# Use sub to set bucket names for an S3 Policy.
|
246
|
+
resource 'ManagedPolicy', :Type => "AWS::IAM::ManagedPolicy", :Properties => {
|
247
|
+
:Description => 'Access policy for S3 Buckets',
|
248
|
+
:PolicyDocument => {
|
249
|
+
:Version => "2012-10-17",
|
250
|
+
:Statement => [
|
251
|
+
{
|
252
|
+
:Action => ["s3:ListBucket"],
|
253
|
+
:Effect => "Allow",
|
254
|
+
:Resource => [
|
255
|
+
sub("arn:aws:s3:::${BucketName}"),
|
256
|
+
sub("arn:aws:s3:::${BaseName}${Hash}", {:BaseName => 'Bucket', :Hash => '3bsd73w'}),
|
257
|
+
]
|
258
|
+
}
|
259
|
+
]
|
260
|
+
}
|
261
|
+
}
|
262
|
+
|
241
263
|
# add conditions that can be used elsewhere in the template
|
242
264
|
condition 'myCondition', fn_and(equal("one", "two"), not_equal("three", "four"))
|
243
265
|
|
@@ -94,7 +94,6 @@ def parse_args
|
|
94
94
|
args[:parameters] = Hash[value.split(/;/).map { |pair| parts = pair.split(/=/, 2); [ parts[0], Parameter.new(parts[1]) ] }] #/# fix for syntax highlighting
|
95
95
|
when '--interactive'
|
96
96
|
args[:interactive] = true
|
97
|
-
default and previous values of a parameter. Updated excise_parameter_attributes! to support multiple parameters.
|
98
97
|
when '--region'
|
99
98
|
args[:region] = value
|
100
99
|
when '--profile'
|
@@ -265,6 +265,15 @@ def get_azs(region = '') { :'Fn::GetAZs' => region } end
|
|
265
265
|
|
266
266
|
def import_value(value) { :'Fn::ImportValue' => value } end
|
267
267
|
|
268
|
+
# There are two valid forms of Fn::Sub, with a map and without.
|
269
|
+
def sub(sub_string, var_map = {})
|
270
|
+
if var_map.empty?
|
271
|
+
return { :'Fn::Sub' => sub_string }
|
272
|
+
else
|
273
|
+
return { :'Fn::Sub' => [sub_string, var_map] }
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
268
277
|
def join(delim, *list)
|
269
278
|
case list.length
|
270
279
|
when 0 then ''
|