Last active
November 16, 2016 06:05
-
-
Save chrisroberts/3fa938e4208b0d2d2111169f633b92c7 to your computer and use it in GitHub Desktop.
This file contains 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
SparkleFormation.new(:terra_test, :provider => :terraform) do | |
parameters do | |
aws_region do | |
description 'The AWS region to create things in.' | |
default 'us-east-1' | |
end | |
aws_amis do | |
default.data!['us-east-1'] = 'ami-5f709f34' | |
default.data!['us-west-2'] = 'ami-7f675e4f' | |
end | |
key_name.description 'Name of the SSH keypair to use in AWS.' | |
end | |
provider.aws.region var!(:aws_region) | |
resources do | |
default_eip do | |
type 'aws_eip' | |
properties do | |
instance resource!(:web_instance).web.id | |
vpc true | |
end | |
end | |
default_security_group do | |
type 'aws_security_group' | |
properties do | |
name 'eip_example' | |
description 'Used in terraform' | |
ingress do | |
from_port 22 | |
to_port 22 | |
protocol 'tcp' | |
cidr_blocks ['0.0.0.0/0'] | |
end | |
end | |
end | |
web_instance do | |
type 'aws_instance' | |
properties do | |
instance_type 't2.micro' | |
ami lookup!(var!(:aws_amis), var!(:aws_region)) | |
key_name var!(:key_name) | |
security_groups [resource!(:default_security_group).name] | |
user_data file!('userdata.sh') | |
tags do | |
Name 'eip-example' | |
end | |
end | |
end | |
end | |
outputs do | |
address.value resource!(:web_instance).private_ip | |
set!('elastic ip').value resource!(:default_eip).public_ip | |
end | |
end | |
security_groups [resource!(:default_security_group).name] | |
user_data file!('userdata.sh') | |
tags do | |
Name 'eip-example' | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment