Skip to content

Instantly share code, notes, and snippets.

@ampedandwired
Last active August 26, 2020 03:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ampedandwired/bd79023a305fcfc493857af0fed19b99 to your computer and use it in GitHub Desktop.
Save ampedandwired/bd79023a305fcfc493857af0fed19b99 to your computer and use it in GitHub Desktop.
Splitting cfndsl templates into multiple files
require_relative "subtemplate.rb"
CloudFormation {
instance_type = external_parameters.fetch(:instance_type, "t2.micro")
my_instance(instance_type)
}
def my_instance(instance_type)
EC2_Instance(:MyInstance) {
InstanceType instance_type
}
end
instance_type: m4.xlarge
$ cfndsl -p -y params.yml template.rb
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"MyInstance": {
"Properties": {
"InstanceType": "m4.xlarge"
},
"Type": "AWS::EC2::Instance"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment