Sha256: 4ace7e684a1e549fb0bf4b08d751657a1f4ed67c5813a787c97a9549c829ced0

Contents?: true

Size: 1.79 KB

Versions: 24

Compression:

Stored size: 1.79 KB

Contents

CloudFormation {

  TEST ||= "no value set"
  puts TEST

  Description "Test"

  Parameter("One") {
    String
    Default "Test"
    MaxLength 15
  }

  Parameter('Two') {
    String
    Default 'Test'
    MaxLength 15
  }

  # Condition Function examples
  Condition('OneIsTest', FnEquals(Ref('One'), 'Test'))
  Condition('OneIsNotTest', FnNot(FnEquals(Ref('One'), 'Test')))
  Condition('OneIsTestAndTwoIsTest', FnAnd([
    FnEquals(Ref('One'), 'Test'),
    FnNot(FnEquals(Ref('Two'), 'Test')),
  ]))

  Condition('OneIsTestOrTwoIsTest', FnOr([
    FnEquals(Ref('One'), 'Test'),
    FnEquals(Ref('Two'), 'Test'),
  ]))

  Output(:One, FnBase64(Ref("One")))

  Resource("MyInstance") {
    Condition 'OneIsNotTest'
    Type "AWS::EC2::Instance"
    Property("ImageId", "ami-14341342")
  }

  LaunchConfiguration("Second") {
    Condition 'OneIsNotTest'
    BlockDeviceMapping {
      DeviceName "/dev/sda"
      VirtualName "stuff"
      Ebs {
        SnapshotId "asdasdfasdf"
        VolumeSize Ref("MyInstance")
      }
    }
  }

  Parameter("ElbSubnets") {
    Type "CommaDelimitedList"
    Default "subnet-12345, subnet-54321"
  }

  Resource("ElasticLoadBalancer") {
    Type "AWS::ElasticLoadBalancing::LoadBalancer"
    Property("Subnets", [ FnSelect("0", Ref("ElbSubnets")), FnSelect("1", Ref("ElbSubnets")) ] )
  }

  AutoScalingGroup("ASG") { 
    UpdatePolicy("AutoScalingRollingUpdate", {
                 "MinInstancesInService" => "1",
                 "MaxBatchSize"          => "1",
                 "PauseTime"             => "PT15M"
                 })
    AvailabilityZones FnGetAZs("")
    LaunchConfigurationName Ref("LaunchConfig")
    MinSize 1
    MaxSize FnIf('OneIsTest', 1, 3)
    LoadBalancerNames Ref("ElasticLoadBalancer")
  }

  LaunchConfiguration("LaunchConfig")

  #UndefinedResource("asddfasdf")
}

Version data entries

24 entries across 24 versions & 1 rubygems

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