cloudformation-tool 0.6.0 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +32 -1
- data/lib/cloud_formation_tool/cloud_formation/stack.rb +26 -16
- data/lib/cloud_formation_tool/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94cf14cf65ed21845906c4101a74e8bdf04aef9c
|
4
|
+
data.tar.gz: cff797604a819f29b3a9d442e260c714c031b9b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab8abfdfdc092df31ed5b1de0f8d73f16edb35285646df0445bdc60b15d2f41904309d4f36d376ee24a789f26e8233476720f32f6e68d4d976c1d1d06632b789
|
7
|
+
data.tar.gz: 09dc1249e7734e35dc44f14093d7a6e90f23a56e842184020bd718fd265513acbdb570a58d8776eaa587028378b8d73246b637e79efa93b109a247d6cc6dd220
|
data/README.md
CHANGED
@@ -125,7 +125,7 @@ user-data block, it will first be compressed using gzip and if it is still too l
|
|
125
125
|
be uploaded to S3 and the user-data block will be set with a cloud-init download reference to
|
126
126
|
the S3 object.
|
127
127
|
|
128
|
-
##### Enhanced write_files
|
128
|
+
##### Enhanced `write_files`
|
129
129
|
|
130
130
|
The ("Cloud Config data" format supports deploying files)[http://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files]
|
131
131
|
into the instance using the `write_files` module. This normally requires the file content
|
@@ -137,8 +137,24 @@ are binary, or just too large).
|
|
137
137
|
To use an external file in `write_files` instead of specifying the file content using the
|
138
138
|
`content` field, use a `file` field to specify the relative path to the file to be loaded.
|
139
139
|
|
140
|
+
##### `write_directories`
|
141
|
+
|
142
|
+
In the case that you want to deploy multiple files to the same directory, instead of
|
143
|
+
listing each and every file as a `write_files` entries (which can get tedious after
|
144
|
+
a while, even with the `file` extension), `cftool` offers another cloud-init extension
|
145
|
+
as a category named `write_directories`.
|
146
|
+
|
147
|
+
The `write_directories` section is a list where each entry specifies a local
|
148
|
+
directory that would be deployed (with all files it includes, recursively - so make
|
149
|
+
sure it only includes files you want to deploy) to a target directory on the deployed
|
150
|
+
server. For each entry specify a `source` attribute that points to a local directory
|
151
|
+
relative to the location of the cloud-init file, and a `target` attribute set to an
|
152
|
+
absolute URL to where to deploy the source directory.
|
153
|
+
|
140
154
|
#### Example:
|
141
155
|
|
156
|
+
`cloud-formation.yaml`:
|
157
|
+
|
142
158
|
```
|
143
159
|
LaunchConfigurationForServer:
|
144
160
|
Type: AWS::AutoScaling::LaunchConfiguration
|
@@ -154,6 +170,21 @@ To use an external file in `write_files` instead of specifying the file content
|
|
154
170
|
File: config.init
|
155
171
|
```
|
156
172
|
|
173
|
+
`config.init`:
|
174
|
+
|
175
|
+
```
|
176
|
+
#cloud-config
|
177
|
+
|
178
|
+
write_files:
|
179
|
+
- path: /etc/default/my-app
|
180
|
+
permissions: '0755'
|
181
|
+
file: my-app.config
|
182
|
+
|
183
|
+
write_directory:
|
184
|
+
- source: my-app-data
|
185
|
+
target: /usr/share/my-app
|
186
|
+
```
|
187
|
+
|
157
188
|
### Loading Lambda code
|
158
189
|
|
159
190
|
When specifying the `Code` property of a `AWS::Lambda::Function` resource, instead of
|
@@ -29,19 +29,21 @@ module CloudFormationTool
|
|
29
29
|
|
30
30
|
def update(url, filepath, params = {})
|
31
31
|
log "Updating existing stack '#{name}' from '#{filepath}' params #{params.inspect}"
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
check do
|
33
|
+
resp = awscf.update_stack({
|
34
|
+
stack_name: @name,
|
35
|
+
template_url: url,
|
36
|
+
capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM),
|
37
|
+
parameters: params.collect do |k,v|
|
38
|
+
{
|
39
|
+
parameter_key: k.to_s,
|
40
|
+
parameter_value: v.to_s,
|
41
|
+
use_previous_value: false,
|
42
|
+
}
|
43
|
+
end
|
44
|
+
})
|
45
|
+
resp.stack_id
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def create(template, params = {})
|
@@ -49,7 +51,7 @@ module CloudFormationTool
|
|
49
51
|
url = upload(make_filename('yaml'), @template, gzip: false)
|
50
52
|
return update(url, template, params) if exist?
|
51
53
|
log "Creating stack '#{name}' from '#{template}' params #{params.inspect}"
|
52
|
-
|
54
|
+
check do
|
53
55
|
resp = awscf.create_stack({
|
54
56
|
stack_name: @name,
|
55
57
|
template_url: url,
|
@@ -64,8 +66,6 @@ module CloudFormationTool
|
|
64
66
|
end
|
65
67
|
})
|
66
68
|
@stack_id = resp.stack_id
|
67
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
68
|
-
raise CloudFormationTool::Errors::ValidationError, "Stack validation error: #{e.message}"
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -171,6 +171,16 @@ module CloudFormationTool
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
174
|
+
|
175
|
+
private
|
176
|
+
|
177
|
+
def check
|
178
|
+
begin
|
179
|
+
yield
|
180
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
181
|
+
raise CloudFormationTool::Errors::ValidationError, "Stack validation error: #{e.message}"
|
182
|
+
end
|
183
|
+
end
|
174
184
|
|
175
185
|
end
|
176
186
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: aws-sdk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.6.13
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: A pre-compiler tool for CloudFormation YAML templates
|