templates/AWSQuickstart-MSSQL.yml [1047:1101]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Parameters:
      commands: 
        - |     
           function DscStatusCheck () {
               $LCMState = (Get-DscLocalConfigurationManager).LCMState
               if ($LCMState -eq 'PendingConfiguration' -Or $LCMState -eq 'PendingReboot') {
                   'returning 3010, should continue after reboot'
                   exit 3010
               } else {
                 'Completed'
               }
           }
           
           Start-DscConfiguration 'C:\AWSQuickstart\AddAG' -Wait -Verbose -Force

           DscStatusCheck
# Determines if CFN Needs to be Signaled or if Work flow should just end
- name: CFNSignalEnd
  action: aws:branch
  inputs:
    Choices:
    - NextStep: signalsuccess
      Not: 
        Variable: "{{StackName}}"
        StringEquals: ""
    - NextStep: sleepend
      Variable: "{{StackName}}"
      StringEquals: ""
# If all steps complete successfully signals CFN of Success
- name: "signalsuccess"
  action: "aws:executeAwsApi"
  isEnd: True
  inputs:
    Service: cloudformation
    Api: SignalResource
    LogicalResourceId: "SSMWaitCondition"
    StackName: "{{StackName}}"
    Status: SUCCESS
    UniqueId: "{{wsfcNode2InstanceId.InstanceId}}"
# If CFN Signl Not Needed this sleep ends work flow
- name: "sleepend"
  action: "aws:sleep"
  isEnd: True
  inputs:
    Duration: PT1S
# If any steps fails signals CFN of Failure
- name: "signalfailure"
  action: "aws:executeAwsApi"
  inputs:
    Service: cloudformation
    Api: SignalResource
    LogicalResourceId: "SSMWaitCondition"
    StackName: "{{StackName}}"
    Status: FAILURE
    UniqueId: "{{wsfcNode2InstanceId.InstanceId}}"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



templates/sql.template.yaml [2254:2308]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Parameters:
              commands: 
                - |     
                   function DscStatusCheck () {
                       $LCMState = (Get-DscLocalConfigurationManager).LCMState
                       if ($LCMState -eq 'PendingConfiguration' -Or $LCMState -eq 'PendingReboot') {
                           'returning 3010, should continue after reboot'
                           exit 3010
                       } else {
                         'Completed'
                       }
                   }
                   
                   Start-DscConfiguration 'C:\AWSQuickstart\AddAG' -Wait -Verbose -Force
        
                   DscStatusCheck
        # Determines if CFN Needs to be Signaled or if Work flow should just end
        - name: CFNSignalEnd
          action: aws:branch
          inputs:
            Choices:
            - NextStep: signalsuccess
              Not: 
                Variable: "{{StackName}}"
                StringEquals: ""
            - NextStep: sleepend
              Variable: "{{StackName}}"
              StringEquals: ""
        # If all steps complete successfully signals CFN of Success
        - name: "signalsuccess"
          action: "aws:executeAwsApi"
          isEnd: True
          inputs:
            Service: cloudformation
            Api: SignalResource
            LogicalResourceId: "SSMWaitCondition"
            StackName: "{{StackName}}"
            Status: SUCCESS
            UniqueId: "{{wsfcNode2InstanceId.InstanceId}}"
        # If CFN Signl Not Needed this sleep ends work flow
        - name: "sleepend"
          action: "aws:sleep"
          isEnd: True
          inputs:
            Duration: PT1S
        # If any steps fails signals CFN of Failure
        - name: "signalfailure"
          action: "aws:executeAwsApi"
          inputs:
            Service: cloudformation
            Api: SignalResource
            LogicalResourceId: "SSMWaitCondition"
            StackName: "{{StackName}}"
            Status: FAILURE
            UniqueId: "{{wsfcNode2InstanceId.InstanceId}}"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



