Skip to content

Issue with GitHub Actions workflow cd-deploy if condition #396

@a-mohan1

Description

@a-mohan1

There's an issue in the cd-deploy.yml file in github workflows, on line 35 under tf-apply:
if: ${{ steps.tf-plan.outcome }} == 'success'
This needed to be corrected to:
if: ${{ steps.tf-plan.outcome == 'success' }}

I also found set-output is deprecated. This was the corrected code snippet that worked:

 - name: TF Apply
   id: tf-apply
   working-directory: '06-best-practices/code/infrastructure'
   if: ${{ steps.tf-plan.outcome == 'success' }}
   run: |
      terraform apply -auto-approve -var-file=vars/prod.tfvars
      echo "ecr_repo=$(terraform output -raw ecr_repo)" >> $GITHUB_OUTPUT
      echo "predictions_stream_name=$(terraform output -raw predictions_stream_name)" >> $GITHUB_OUTPUT
      echo "model_bucket=$(terraform output -raw model_bucket)" >> $GITHUB_OUTPUT
      echo "lambda_function=$(terraform output -raw lambda_function)" >> $GITHUB_OUTPUT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions