title: CodeBuild shows SUCCEEDED; however, it should be saying FAILED when using Packer
body: <p>I am running into an issue which I know has to do with my <code>buildspec.yml</code> file:</p>
  <pre><code>phases:
    install:
      runtime-versions:
        python: 3.8
    pre_build:
      commands:
        - echo &quot;Installing Packer&quot;
        - curl -o packer.zip https://releases.hashicorp.com/packer/1.7.2/packer_1.7.2_linux_amd64.zip &amp;&amp; unzip packer.zip
        - echo &quot;Validating Packer template&quot;
        - ./packer validate pipeline/build/${FUNCTION}-build.json
    build:
      commands:
        - ./packer build -color=false pipeline/build/${FUNCTION}-build.json | tee build.log
    post_build:
      commands:
        # Get the ARN of our Lambda notifier
        - SLACK_ARN=$(aws cloudformation list-exports | jq -r '.[&quot;Exports&quot;][] | select(.Name == &quot;notify_slack_arn&quot;) | .Value')
        # Send a Slack notification
        - |
          if [ &quot;${CODEBUILD_BUILD_SUCCEEDING}&quot; -eq 1 ]
          then
            aws lambda invoke --cli-binary-format raw-in-base64-out --function-name ${SLACK_ARN} --payload &quot;{ \&quot;LambdaInvokeEvent\&quot;: { \&quot;message\&quot;: \&quot;Daily AMI Build for ${FUNCTION} SUCCESSFUL!\&quot;, \&quot;slack_url\&quot;: \&quot;${SLACK_URL}\&quot; } }&quot; slack_output.log
          else
            aws lambda invoke --cli-binary-format raw-in-base64-out --function-name ${SLACK_ARN} --payload &quot;{ \&quot;LambdaInvokeEvent\&quot;: { \&quot;message\&quot;: \&quot;Daily AMI Build for ${FUNCTION} FAILED!\&quot;, \&quot;slack_url\&quot;: \&quot;${SLACK_URL}\&quot; } }&quot; slack_output.log
          fi
        - echo &quot;Build completed on $(date)&quot;
  artifacts:
    files:
      - &quot;**/*&quot;
    discard-paths: no
  </code></pre>
  <p>So from my code that builds in CodeBuild, this is what happens:<a href="https://i.stack.imgur.com/KY50d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KY50d.png" alt="enter image description here" /></a></p>
  <p>Even though it fails, CodeBuild says SUCCEEDED which is driving me nuts! It is suppose to fail and give a failing notification. Does this have to do with my <code>buildspec.yml</code> file or my bash script that is running? Thanks!</p>