cloudformation-tool 0.2.3 → 0.3.0
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 +29 -6
- data/lib/cloud_formation_tool/cloud_formation.rb +3 -0
- data/lib/cloud_formation_tool/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b666772e81896aee5d50a355876f1495e826a5ad
|
4
|
+
data.tar.gz: 5095910a6c3a633fd403387ba1b77017fa75b6d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4259484c8a74b199d52d69a506c47518b31bff665336321c98cb0001624cfd1d0b99f14f872cf3027c8bbe7efe35d3ebceeef91ecc829df961c006a3502abb1f
|
7
|
+
data.tar.gz: c423832920011940388d0cb7a591cda512fef5b2e1a438328515b64ae473600dd968007e51a15ad227c2d1b3241462a3aab0ede6045d1aa0752eaed0822bcb40
|
data/README.md
CHANGED
@@ -107,12 +107,35 @@ When specifying a user-data block for a `LaunchConfiguration` resource or an `In
|
|
107
107
|
resource, the user-data can be loaded from an external YAML file (only YAML formatted user-data
|
108
108
|
is currently supported, sorry) by specifying the `UserData` element as a map with the single
|
109
109
|
field `File` that is set with the relative path to the user-data file. The user-data file is
|
110
|
-
expected to be a cloud-init file with the extension `.init`.
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
expected to be a cloud-init configuration file with the default extension `.init`.
|
111
|
+
|
112
|
+
Alternatively, the field `FileTemplate` can be used under `UserData` to load an external cloud-init configuration file that includes variable place holders for the
|
113
|
+
(CloudFormation intrinsic function Sub)[http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html]. The `FileTemplate` mode supports all
|
114
|
+
the features described above as well as it performs the parsing detailed below, except
|
115
|
+
compression and S3 offloading - as doing so prevents CloudFormation from performing the
|
116
|
+
substitution operation. As a result, if the resulting cloud-init file is larger than 16KB
|
117
|
+
you should expect that the template will fail to create the server.
|
118
|
+
|
119
|
+
#### User data file parsing
|
120
|
+
|
121
|
+
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` enhancement (see below). The result is then checked that it
|
123
|
+
does not exceed the user-data size limitation. If the file is bigger than can fit in the AWS
|
124
|
+
user-data block, it will first be compressed using gzip and if it is still too large, it will
|
125
|
+
be uploaded to S3 and the user-data block will be set with a cloud-init download reference to
|
126
|
+
the S3 object.
|
127
|
+
|
128
|
+
##### Enhanced write_files
|
129
|
+
|
130
|
+
The ("Cloud Config data" format supports deploying files)[http://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files]
|
131
|
+
into the instance using the `write_files` module. This normally requires the file content
|
132
|
+
to be embedded directly into the cloud-config YAML format. The cloudformation-tool supports
|
133
|
+
specifying external files to be loaded, allowing deployed files to be managed externally to
|
134
|
+
the cloud-config data (for example, if you enjoy using syntax aware editors to edit them,
|
135
|
+
are binary, or just too large).
|
136
|
+
|
137
|
+
To use an external file in `write_files` instead of specifying the file content using the
|
138
|
+
`content` field, use a `file` field to specify the relative path to the file to be loaded.
|
116
139
|
|
117
140
|
#### Example:
|
118
141
|
|
@@ -131,6 +131,9 @@ module CloudFormationTool
|
|
131
131
|
dict[key] = if (key == "UserData") and (val["File"])
|
132
132
|
# Support LaunchConfiguration UserData from file
|
133
133
|
CloudInit.new("#{@basedir}/#{val["File"]}").to_base64
|
134
|
+
elsif (key == "UserData") and (val["FileTemplate"])
|
135
|
+
# Support LaunchConfiguration UserData from file with substitutions
|
136
|
+
{ "Fn::Base64" => { "Fn::Sub" => CloudInit.new("#{@basedir}/#{val["File"]}").compile } }
|
134
137
|
elsif (key == "Code") and (val["URL"])
|
135
138
|
# Support Lambda Code from arbitrary URLs
|
136
139
|
LambdaCode.new(val["URL"]).to_cloudformation
|