Sha256: d9771cb2cf6c68198c18edafaf5940095307a84720b7f13f8a6472d220dabb26

Contents?: true

Size: 1.64 KB

Versions: 15

Compression:

Stored size: 1.64 KB

Contents

require_relative '../lib/convection'

module Convection
  module Demo
    VPC = Convection.template do
      description 'Demo VPC'

      ## Define the VPC
      ec2_vpc 'TargetVPC' do
        network stack['subnet']
        subnet_length 24
        enable_dns true

        tag 'Name', stack.cloud
        tag 'Stack', stack.cloud
        with_output 'id'

        ## Add an InternetGateway
        add_internet_gateway

        public_acl = add_network_acl 'Public' do
          entry 'AllowAllIngress' do
            action 'allow'
            number 100
            network '0.0.0.0/0'
            protocol :any
            range :From => 0,
                  :To => 65_535
          end

          entry 'AllowAllEgress' do
            action 'allow'
            number 100
            egress true
            network '0.0.0.0/0'
            protocol :any
            range :From => 0,
                  :To => 65_535
          end

          tag 'Name', "acl-public-#{ stack.cloud }"
          tag 'Stack', stack.cloud
        end

        public_table = add_route_table 'Public', :gateway_route => true do
          tag 'Name', "routes-public-#{ stack.cloud }"
          tag 'Stack', stack.cloud
        end

        stack.availability_zones do |zone, i|
          add_subnet "Public#{ i }" do
            availability_zone zone
            acl public_acl
            route_table public_table

            with_output

            immutable_metadata "public-#{ stack.cloud }"
            tag 'Name', "subnet-public-#{ stack.cloud }-#{ zone }"
            tag 'Stack', stack.cloud
            tag 'Service', 'Public'
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
convection-0.2.15 example/vpc.rb
convection-0.2.14 example/vpc.rb
convection-0.2.13 example/vpc.rb
convection-0.2.12 example/vpc.rb
convection-0.2.11 example/vpc.rb
convection-0.2.10 example/vpc.rb
convection-0.2.9 example/vpc.rb
convection-0.2.8 example/vpc.rb
convection-0.2.7 example/vpc.rb
convection-0.2.6 example/vpc.rb
convection-0.2.5 example/vpc.rb
convection-0.2.4 example/vpc.rb
convection-0.2.3 example/vpc.rb
convection-0.2.2 example/vpc.rb
convection-0.2.1 example/vpc.rb