apply-infrastructure #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: apply-infrastructure | |
on: | |
workflow_run: | |
workflows: ["build-push-lambda-image-ecr"] | |
types: | |
- completed | |
jobs: | |
apply: | |
defaults: | |
run: | |
working-directory: ${{ vars.TF_ACTIONS_WORKING_DIR }} | |
runs-on: ubuntu-latest | |
if: github.event.workflow_run.conclusion == 'success' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Download consolidated image details | |
uses: actions/download-artifact@v2 | |
with: | |
name: consolidated | |
path: . | |
- name: Set image URIs | |
run: | | |
echo "INGESTION_IMAGE=$(jq -r '.ingestion | "\(.ECR_REGISTRY)/\(.ECR_REPOSITORY):\(.IMAGE_TAG)"' consolidated-image-details.json)" >> "$GITHUB_ENV" | |
echo "INFERENCE_IMAGE=$(jq -r '.inference | "\(.ECR_REGISTRY)/\(.ECR_REPOSITORY):\(.IMAGE_TAG)"' consolidated-image-details.json)" >> "$GITHUB_ENV" | |
echo "MEMORY_IMAGE=$(jq -r '.conversation_memory | "\(.ECR_REGISTRY)/\(.ECR_REPOSITORY):\(.IMAGE_TAG)"' consolidated-image-details.json)" >> "$GITHUB_ENV" | |
echo "LIST_COLLECTIONS_IMAGE=$(jq -r '.list_collections | "\(.ECR_REGISTRY)/\(.ECR_REPOSITORY):\(.IMAGE_TAG)"' consolidated-image-details.json)" >> "$GITHUB_ENV" | |
- name: Terraform Init | |
id: terraform-Init | |
run: | | |
terraform init -no-color -upgrade | |
- name: Terraform Apply | |
id: terraform-Apply | |
run: | | |
terraform apply -var="ingestion_lambda_image_uri=${{ env.INGESTION_IMAGE }}" -var="inference_lambda_image_uri=${{ env.INFERENCE_IMAGE }}" -var="memory_lambda_image_uri=${{ env.MEMORY_IMAGE }}" -var="list_collections_lambda_image_uri=${{ env.LIST_COLLECTIONS_IMAGE }}" -no-color -auto-approve |