Skip to content

Instantly share code, notes, and snippets.

@ampedandwired

ampedandwired/ template.rb

Last active Aug 26, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.