Sha256: 14c51fc60432376cbe96c481520ebabd4308281393b57251f668e18bf4c589e5

Contents?: true

Size: 1.97 KB

Versions: 59

Compression:

Stored size: 1.97 KB

Contents

require_relative '../resource'

module Convection
  module Model
    class Template
      class Resource
        ##
        # AWS::EC2::Instance
        ##
        class EC2Instance < Resource
          include Model::Mixin::Taggable

          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'
          property :disable_api_termination, 'DisableApiTermination'
          property :network_interfaces, 'NetworkInterfaces', :type => :list
          property :block_devices, 'BlockDeviceMappings', :type => :list
          property :volumes, 'Volumes', :type => :list

          # Append a network interface to network_interfaces
          def network_interface(&block)
            interface = ResourceProperty::EC2NetworkInterface.new(self)
            interface.instance_exec(&block) if block
            interface.device_index = network_interfaces.count.to_s
            network_interfaces << interface
          end

          # Append a block device mapping
          def block_device(&block)
            block_device = ResourceProperty::EC2BlockDeviceMapping.new(self)
            block_device.instance_exec(&block) if block
            block_devices << block_device
          end

          # Append a volume to volumes
          def volume(&block)
            volume = ResourceProperty::EC2MountPoint.new(self)
            volume.instance_exec(&block) if block
            volumes << volume
          end

          def render(*args)
            super.tap do |resource|
              render_tags(resource)
            end
          end
        end
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
convection-2.2.6 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.2.5 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.2.4 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.2.3 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.2.2 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.2.1 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.2.0 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.1.2 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.1.1 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.1.0 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-2.0.0 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.7 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.5 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.4 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.3 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.2 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.1 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.1.0 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.0.7 lib/convection/model/template/resource/aws_ec2_instance.rb
convection-1.0.6 lib/convection/model/template/resource/aws_ec2_instance.rb