Sha256: d0991e0d7f2f8079cccb9d5283fb4c4d1e15fb763094893611b3bd49a195dc45

Contents?: true

Size: 1.98 KB

Versions: 35

Compression:

Stored size: 1.98 KB

Contents

CloudFormation do
  TEST ||= 'no value set'.freeze
  puts TEST

  Description external_parameters[:test]

  Parameter('One') do
    String
    Default 'Test'
    MaxLength 15
  end

  Parameter('Two') do
    String
    Default 'Test'
    MaxLength 15
  end

  # 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') do
    Condition 'OneIsNotTest'
    Type 'AWS::EC2::Instance'
    Property('ImageId', 'ami-14341342')
  end

  LaunchConfiguration('Second') do
    Condition 'OneIsNotTest'
    BlockDeviceMapping do
      DeviceName '/dev/sda'
      VirtualName 'stuff'
      Ebs do
        SnapshotId external_parameters[:test]
        VolumeSize Ref('MyInstance')
      end
    end
  end

  Parameter('ElbSubnets') do
    Type 'CommaDelimitedList'
    Default 'subnet-12345, subnet-54321'
  end

  Resource('ElasticLoadBalancer') do
    Type 'AWS::ElasticLoadBalancing::LoadBalancer'
    Property('Subnets', [FnSelect('0', Ref('ElbSubnets')), FnSelect('1', Ref('ElbSubnets'))])
  end

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

  LaunchConfiguration('LaunchConfig')

  # UndefinedResource('asddfasdf')
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
cfndsl-0.15.2 spec/fixtures/test.rb
cfndsl-0.15.1 spec/fixtures/test.rb
cfndsl-0.15.0 spec/fixtures/test.rb
cfndsl-0.14.0 spec/fixtures/test.rb
cfndsl-0.13.1 spec/fixtures/test.rb
cfndsl-0.13.0 spec/fixtures/test.rb
cfndsl-0.12.11 spec/fixtures/test.rb
cfndsl-0.12.10 spec/fixtures/test.rb
cfndsl-0.12.9 spec/fixtures/test.rb
cfndsl-0.12.8 spec/fixtures/test.rb
cfndsl-0.12.7 spec/fixtures/test.rb
cfndsl-0.12.6 spec/fixtures/test.rb
cfndsl-0.12.5 spec/fixtures/test.rb
cfndsl-0.12.4 spec/fixtures/test.rb
cfndsl-0.12.3 spec/fixtures/test.rb
cfndsl-0.12.2 spec/fixtures/test.rb
cfndsl-0.12.1 spec/fixtures/test.rb
cfndsl-0.12.0 spec/fixtures/test.rb
cfndsl-0.11.12 spec/fixtures/test.rb
cfndsl-0.11.11 spec/fixtures/test.rb