Skip to content

Commit

Permalink
service and network deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispsheehan committed Sep 30, 2024
1 parent 30052e0 commit 6c602a1
Showing 1 changed file with 78 additions and 80 deletions.
158 changes: 78 additions & 80 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,87 +75,85 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
aws_role: ${{ vars.AWS_ROLE }}

service:
needs:
- check
- init
if: ${{ needs.check.outputs.service_exists == 'false' }}
runs-on: ubuntu-latest
env:
TF_VAR_task_definition_arn: ${{ needs.init.outputs.task_definition_arn }}
outputs:
cluster_name: ${{ steps.set-envs.outputs.CLUSTER_NAME }}
service_name: ${{ steps.set-envs.outputs.SERVICE_NAME }}
lb_listener_arn: ${{ steps.set-envs.outputs.LB_LISTENER_ARN }}
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.aws_region }}
role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
role-session-name: GitHubActions

# service:
# needs:
# - check
# - init
# if: ${{ needs.check.outputs.service_exists == 'false' }}
# runs-on: ubuntu-latest
# env:
# TF_VAR_task_definition_arn: ${{ needs.init.outputs.task_definition_arn }}
# outputs:
# cluster_name: ${{ steps.set-envs.outputs.CLUSTER_NAME }}
# service_name: ${{ steps.set-envs.outputs.SERVICE_NAME }}
# lb_listener_arn: ${{ steps.set-envs.outputs.LB_LISTENER_ARN }}
# steps:
# - uses: actions/checkout@v4
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: ${{ vars.aws_region }}
# role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
# role-session-name: GitHubActions

# - name: Init
# shell: bash
# run: |
# cd tf/service
# terraform init
- name: Init
shell: bash
run: |
cd tf/service
terraform init
# - name: Deploy
# shell: bash
# id: deploy
# run: |
# cd tf/service
# terraform apply -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars

# - name: Set env vars
# id: set-envs
# shell: bash
# run: |
# cd tf/service
# LB_LISTENER_ARN=$(terraform output -raw lb_listener_arn)
# echo "LB_LISTENER_ARN=$LB_LISTENER_ARN" >> $GITHUB_OUTPUT


# network:
# needs:
# - check
# - service
# if: ${{ needs.check.outputs.service_exists == 'false' }}
# runs-on: ubuntu-latest
# env:
# TF_VAR_load_balancer_listener_arn: ${{ needs.service.outputs.lb_listener_arn }}
# outputs:
# api_invoke_url: ${{ steps.set-envs.outputs.API_INVOKE_URL }}
# steps:
# - uses: actions/checkout@v4
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: ${{ vars.aws_region }}
# role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
# role-session-name: GitHubActions

# - name: Init
# shell: bash
# run: |
# cd tf/network
# terraform init
- name: Deploy
shell: bash
id: deploy
run: |
cd tf/service
terraform apply -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars
- name: Set env vars
id: set-envs
shell: bash
run: |
cd tf/service
LB_LISTENER_ARN=$(terraform output -raw lb_listener_arn)
echo "LB_LISTENER_ARN=$LB_LISTENER_ARN" >> $GITHUB_OUTPUT
network:
needs:
- check
- service
if: ${{ needs.check.outputs.service_exists == 'false' }}
runs-on: ubuntu-latest
env:
TF_VAR_load_balancer_listener_arn: ${{ needs.service.outputs.lb_listener_arn }}
outputs:
api_invoke_url: ${{ steps.set-envs.outputs.API_INVOKE_URL }}
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.aws_region }}
role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
role-session-name: GitHubActions

- name: Init
shell: bash
run: |
cd tf/network
terraform init
# - name: Deploy
# shell: bash
# id: deploy
# run: |
# cd tf/network
# terraform apply -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars

# - name: Set env vars
# id: set-envs
# shell: bash
# run: |
# cd tf/network
# API_INVOKE_URL=$(terraform output -raw api_invoke_url)
# echo "API_INVOKE_URL=$API_INVOKE_URL" >> $GITHUB_OUTPUT
- name: Deploy
shell: bash
id: deploy
run: |
cd tf/network
terraform apply -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars
- name: Set env vars
id: set-envs
shell: bash
run: |
cd tf/network
API_INVOKE_URL=$(terraform output -raw api_invoke_url)
echo "API_INVOKE_URL=$API_INVOKE_URL" >> $GITHUB_OUTPUT

0 comments on commit 6c602a1

Please sign in to comment.