Last active
August 26, 2020 03:43
-
-
Save ampedandwired/bd79023a305fcfc493857af0fed19b99 to your computer and use it in GitHub Desktop.
Splitting cfndsl templates into multiple files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "subtemplate.rb" | |
CloudFormation { | |
instance_type = external_parameters.fetch(:instance_type, "t2.micro") | |
my_instance(instance_type) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_instance(instance_type) | |
EC2_Instance(:MyInstance) { | |
InstanceType instance_type | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance_type: m4.xlarge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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