Description: examples/scale_map.yaml
HeatTemplateFormatVersion: '2012-12-12'
Resources:
  ComputeUser:
    Properties:
      Policies:
      - Ref: ComputeAccessPolicy
    Type: AWS::IAM::User
  GlobalAccessPolicy:
    Type: OS::Heat::AccessPolicy
  NovaCompute0:
    Metadata:
      os-collect-config:
        cfn:
          access_key_id:
            Ref: NovaCompute0Key
          path: NovaCompute0Config.Metadata
          secret_access_key:
            Fn::GetAtt:
            - NovaCompute0Key
            - SecretAccessKey
          stack_name:
            Ref: AWS::StackName
    Properties:
      image:
        Ref: ComputeImage
    Type: OS::Nova::Server
  NovaCompute0CompletionCondition:
    DependsOn: notcompute
    Properties:
      Count: '1'
      Handle:
        Ref: NovaCompute0CompletionHandle
      Timeout: '1800'
    Type: AWS::CloudFormation::WaitCondition
  NovaCompute0CompletionHandle:
    Type: AWS::CloudFormation::WaitConditionHandle
  NovaCompute0Config:
    Metadata:
      completion-handle:
        Ref: NovaCompute0CompletionHandle
      hosts:
        Fn::Join:
        - '

          '
        - - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute0
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute0
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute0
                      - show
                  - local
          - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute1
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute1
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute1
                      - show
                  - local
          - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute2
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute2
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute2
                      - show
                  - local
      os-collect-config:
        cfn:
          access_key_id:
            Ref: NovaCompute0Key
          path: NovaCompute0Config.Metadata
          secret_access_key:
            Fn::GetAtt:
            - NovaCompute0Key
            - SecretAccessKey
          stack_name:
            Ref: AWS::StackName
    Type: AWS::AutoScaling::LaunchConfiguration
  NovaCompute0Key:
    Properties:
      UserName:
        Ref: ComputeUser
    Type: AWS::IAM::AccessKey
  NovaCompute1:
    Metadata:
      os-collect-config:
        cfn:
          access_key_id:
            Ref: NovaCompute1Key
          path: NovaCompute1Config.Metadata
          secret_access_key:
            Fn::GetAtt:
            - NovaCompute1Key
            - SecretAccessKey
          stack_name:
            Ref: AWS::StackName
    Properties:
      image:
        Ref: ComputeImage
    Type: OS::Nova::Server
  NovaCompute1CompletionCondition:
    DependsOn: notcompute
    Properties:
      Count: '1'
      Handle:
        Ref: NovaCompute1CompletionHandle
      Timeout: '1800'
    Type: AWS::CloudFormation::WaitCondition
  NovaCompute1CompletionHandle:
    Type: AWS::CloudFormation::WaitConditionHandle
  NovaCompute1Config:
    Metadata:
      completion-handle:
        Ref: NovaCompute1CompletionHandle
      hosts:
        Fn::Join:
        - '

          '
        - - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute0
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute0
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute0
                      - show
                  - local
          - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute1
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute1
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute1
                      - show
                  - local
          - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute2
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute2
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute2
                      - show
                  - local
      os-collect-config:
        cfn:
          access_key_id:
            Ref: NovaCompute1Key
          path: NovaCompute1Config.Metadata
          secret_access_key:
            Fn::GetAtt:
            - NovaCompute1Key
            - SecretAccessKey
          stack_name:
            Ref: AWS::StackName
    Type: AWS::AutoScaling::LaunchConfiguration
  NovaCompute1Key:
    Properties:
      UserName:
        Ref: ComputeUser
    Type: AWS::IAM::AccessKey
  NovaCompute2:
    Metadata:
      os-collect-config:
        cfn:
          access_key_id:
            Ref: NovaCompute2Key
          path: NovaCompute2Config.Metadata
          secret_access_key:
            Fn::GetAtt:
            - NovaCompute2Key
            - SecretAccessKey
          stack_name:
            Ref: AWS::StackName
    Properties:
      image:
        Ref: ComputeImage
    Type: OS::Nova::Server
  NovaCompute2CompletionCondition:
    DependsOn: notcompute
    Properties:
      Count: '1'
      Handle:
        Ref: NovaCompute2CompletionHandle
      Timeout: '1800'
    Type: AWS::CloudFormation::WaitCondition
  NovaCompute2CompletionHandle:
    Type: AWS::CloudFormation::WaitConditionHandle
  NovaCompute2Config:
    Metadata:
      completion-handle:
        Ref: NovaCompute2CompletionHandle
      hosts:
        Fn::Join:
        - '

          '
        - - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute0
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute0
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute0
                      - show
                  - local
          - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute1
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute1
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute1
                      - show
                  - local
          - Fn::Join:
            - ' '
            - - Fn::Select:
                - 0
                - Fn::Select:
                  - ctlplane
                  - Fn::GetAtt:
                    - NovaCompute2
                    - networks
              - Fn::Select:
                - name
                - Fn::GetAtt:
                  - NovaCompute2
                  - show
              - Fn::Join:
                - .
                - - Fn::Select:
                    - name
                    - Fn::GetAtt:
                      - NovaCompute2
                      - show
                  - local
      os-collect-config:
        cfn:
          access_key_id:
            Ref: NovaCompute2Key
          path: NovaCompute2Config.Metadata
          secret_access_key:
            Fn::GetAtt:
            - NovaCompute2Key
            - SecretAccessKey
          stack_name:
            Ref: AWS::StackName
    Type: AWS::AutoScaling::LaunchConfiguration
  NovaCompute2Key:
    Properties:
      UserName:
        Ref: ComputeUser
    Type: AWS::IAM::AccessKey
