cloudformation-tool 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -17
- data/lib/cloud_formation_tool/cloud_formation.rb +2 -2
- data/lib/cloud_formation_tool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818f632bb0756f9be2ba922936b2a68e93a12d3af1a10b069e48941dd0615cfd
|
4
|
+
data.tar.gz: 612c5e90b2a95f54435e1ddcbd65a4f833863097c61709a7d9d6895dd041c91e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed6cb8daf2f5990b0a0df87149f9537e29153aacaa65c81a73fee2f2dc05e7d882a99463c22e1fafb00f46757961418df392e730cca805783922ad62db6114ba
|
7
|
+
data.tar.gz: 9d584621509bf30401687ca5c946d9dd45d38a9ad6454b929283099db0ed2ae2aa4ddf93eecf2e123936c4c0a98c605bbe9bfb38c44609c94d4b06e09f626cb1
|
data/README.md
CHANGED
@@ -103,27 +103,30 @@ multiple sub-templates, this is an error that would cause the tool to abort.
|
|
103
103
|
|
104
104
|
### Loading user data files
|
105
105
|
|
106
|
-
When specifying a user-data block for a `LaunchConfiguration` resource
|
107
|
-
resource, the user-data can be loaded from an external
|
108
|
-
is currently supported, sorry) by specifying the
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
106
|
+
When specifying a user-data block for a `LaunchConfiguration` resource, `Instance`
|
107
|
+
resource, or a `LaunchTemplate` resource, the user-data can be loaded from an external
|
108
|
+
YAML file (only YAML formatted user-data is currently supported, sorry) by specifying the
|
109
|
+
`UserData` element as a map with the single field `File` that is set with the relative
|
110
|
+
path to the user-data file. The user-data file is expected to be a cloud-init configuration
|
111
|
+
file with the default extension `.init` (but there really aren't any filename requirements).
|
112
|
+
|
113
|
+
Alternatively, the field `FileTemplate` can be used under `UserData` to load an external
|
114
|
+
cloud-init configuration file that includes variable place holders for the
|
115
|
+
(CloudFormation intrinsic function Sub)[http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html].
|
116
|
+
The `FileTemplate` mode supports all the features described above as well as it performs
|
117
|
+
the parsing detailed below, except compression and S3 offloading - as doing so prevents
|
118
|
+
CloudFormation from performing the substitution operation. As a result, if the resulting
|
119
|
+
cloud-init file is larger than 16KB you should expect that the template will fail to create
|
120
|
+
the stack.
|
118
121
|
|
119
122
|
#### User data file parsing
|
120
123
|
|
121
124
|
The reference file will be loaded and parsed as a ("Cloud Config data" file)[http://cloudinit.readthedocs.io/en/latest/topics/format.html#cloud-config-data]
|
122
|
-
with the special `write_files` and `write_directories` enhancement (see below).
|
123
|
-
does not exceed the user-data size limitation.
|
124
|
-
|
125
|
-
|
126
|
-
the S3 object.
|
125
|
+
with the special `write_files` and `write_directories` enhancement (see below).
|
126
|
+
The result is then checked that it does not exceed the user-data size limitation.
|
127
|
+
If the file is bigger than can fit in the AWS user-data block, it will first be compressed
|
128
|
+
using gzip and if it is still too large, it will be uploaded to S3 and the user-data block
|
129
|
+
will be set with a cloud-init download reference to the S3 object.
|
127
130
|
|
128
131
|
##### Enhanced `write_files`
|
129
132
|
|
@@ -23,7 +23,7 @@ module CloudFormationTool
|
|
23
23
|
begin
|
24
24
|
text = File.read(@path)
|
25
25
|
# remove comments because white space seen between comments can seriously psych Psych
|
26
|
-
text.gsub!(/^#.*\n
|
26
|
+
text.gsub!(/^#.*\n/,'')
|
27
27
|
text = fixShorthand(text)
|
28
28
|
@data = YAML.load(text).to_h
|
29
29
|
rescue Psych::SyntaxError => e
|
@@ -167,7 +167,7 @@ module CloudFormationTool
|
|
167
167
|
restype = data['Type'] if restype.nil? and data.key?('Type')
|
168
168
|
data.inject({}) do |dict, (key, val)|
|
169
169
|
dict[key] = case restype
|
170
|
-
when 'AWS::AutoScaling::LaunchConfiguration'
|
170
|
+
when 'AWS::AutoScaling::LaunchConfiguration', 'AWS::EC2::LaunchTemplate'
|
171
171
|
if (key == "UserData") and (val["File"])
|
172
172
|
# Support LaunchConfiguration UserData from file
|
173
173
|
CloudInit.new("#{@basedir}/#{val["File"]}").to_base64
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|