-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 2 KB
/
infra_provisioning.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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