Sha256: 898574ce01e1773eb802fbf60fd87d28639946b2259323927493343b618601b5

Contents?: true

Size: 1.07 KB

Versions: 24

Compression:

Stored size: 1.07 KB

Contents

require 'cfndsl'

CloudFormation {
  Description "Creates an AWS VPC with a couple of subnets."

  VPC(:VPC) {
    EnableDnsSupport true
    EnableDnsHostnames true
    CidrBlock "10.1.0.0/16"
    addTag("Name", "Test VPC")
  }

  InternetGateway(:InternetGateway) {
    addTag("Name", "Test VPC Gateway")
  }

  VPCGatewayAttachment(:GatewayToInternet) {
    VpcId Ref(:VPC)
    InternetGatewayId  Ref(:InternetGateway)
  }

  10.times do |i|
    subnet = "subnet#{i}"
    route_table = subnet + "RouteTable"
    route_table_assoc = route_table + "Assoc"

    Subnet(subnet) {
      VpcId Ref(:VPC)
      CidrBlock "10.1.#{i}.0/24"
      addTag("Name", "test vpc #{subnet}")
    }

    RouteTable(route_table) {
      VpcId Ref(:VPC)
      addTag("Name", route_table)
    }

    SubnetRouteTableAssociation(route_table_assoc) {
      SubnetId Ref(subnet)
      RouteTableId Ref(route_table)
    }

    Route(subnet + "GatewayRoute" ) {
      DependsOn :GatewayToInternet
      RouteTableId Ref(route_table)
      DestinationCidrBlock "0.0.0.0/0"
      GatewayId Ref(:InternetGateway)
    }
  end

}

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
cfndsl-0.4.4 sample/vpc-example.rb
cfndsl-0.4.3 sample/vpc-example.rb
cfndsl-0.4.2 sample/vpc-example.rb
cfndsl-0.4.1 sample/vpc-example.rb
cfndsl-0.4.0 sample/vpc-example.rb
cfndsl-0.3.6 sample/vpc-example.rb
cfndsl-0.3.5 sample/vpc-example.rb
cfndsl-0.3.4 sample/vpc-example.rb
cfndsl-0.3.3 sample/vpc-example.rb
cfndsl-0.3.2 sample/vpc-example.rb
cfndsl-0.3.1 sample/vpc-example.rb
cfndsl-0.2.9 sample/vpc-example.rb
cfndsl-0.2.8 sample/vpc-example.rb
cfndsl-0.3.0 sample/vpc-example.rb
cfndsl-0.2.7 sample/vpc-example.rb
cfndsl-0.2.4 sample/vpc-example.rb
cfndsl-0.2.3 sample/vpc-example.rb
cfndsl-0.2.2 sample/vpc-example.rb
cfndsl-0.2.1 sample/vpc-example.rb
cfndsl-0.2.0 sample/vpc-example.rb