cloudformation-tool 0.2.3 → 0.3.0

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: c4d9af43cf848d20853c9a8385df91072fbf71b4
4
- data.tar.gz: b595890a7682733ee29aa655f4a4a96a14bb23e5
3
+ metadata.gz: b666772e81896aee5d50a355876f1495e826a5ad
4
+ data.tar.gz: 5095910a6c3a633fd403387ba1b77017fa75b6d3
5
5
  SHA512:
6
- metadata.gz: e249d712b5eb07de499135378e1368fe900ebd69a160ae31303dead9cd360155a8979aa85712dcf46f94e9e86227f0dc1f084a69b0dac9111da1b8b277621ce6
7
- data.tar.gz: 8a083bd072f0071d90ab1416bfed85e317d52a0836c251d26d43814dda3ea4294ba8f29e860eda82282902a3dd8ba3753239d84d3672f44eaa926d26d534f648
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
- The loaded file will be checked that it does not exceed the user-data size limitation. If the
113
- file is bigger than can fit in the AWS user-data block, it will first be compressed using gzip
114
- and if it is still too large, it will be uploaded to S3 and the user-data block will be set
115
- with a cloud-init download reference to the S3 object.
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
@@ -1,3 +1,3 @@
1
1
  module CloudFormationTool
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.0'
3
3
  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.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Arbel