lib/convection/model/template/resource/aws_ec2_instance.rb in convection-0.0.1 vs lib/convection/model/template/resource/aws_ec2_instance.rb in convection-0.2.1
- old
+ new
@@ -8,62 +8,26 @@
# AWS::EC2::Instance
##
class EC2Instance < Resource
include Model::Mixin::Taggable
- def initialize(*args)
- super
+ type 'AWS::EC2::Instance'
+ property :availability_zone, 'AvailabilityZone'
+ property :image_id, 'ImageId'
+ property :instance_type, 'InstanceType'
+ property :instance_profile, 'IamInstanceProfile'
+ property :key_name, 'KeyName'
+ property :subnet, 'SubnetId'
+ property :user_data, 'UserData'
+ property :security_group, 'SecurityGroupIds', :type => :list
+ property :src_dst_checks, 'SourceDestCheck'
- type 'AWS::EC2::Instance'
- @properties['SecurityGroupIds'] = []
- end
-
- def availability_zone(value)
- property('AvailabilityZone', value)
- end
-
- def image_id(value)
- property('ImageId', value)
- end
-
- def instance_type(value)
- property('InstanceType', value)
- end
-
- def key_name(value)
- property('KeyName', value)
- end
-
- def security_group(value)
- @properties['SecurityGroupIds'] << value
- end
-
- def subnet(value)
- property('SubnetId', value)
- end
-
- def user_data(value)
- property('UserData', value)
- end
-
def render(*args)
super.tap do |resource|
render_tags(resource)
end
end
end
- end
- end
- end
-
- module DSL
- ## Add DSL method to template namespace
- module Template
- def ec2_instance(name, &block)
- r = Model::Template::Resource::EC2Instance.new(name, self)
-
- r.instance_exec(&block) if block
- resources[name] = r
end
end
end
end