generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 14
44 lines (38 loc) · 1.16 KB
/
bastion.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
name: Turn on/off Bastion Server
on:
workflow_dispatch:
inputs:
state:
description: 'Turn bastion on/off'
required: true
default: 'enable'
env:
BASTION_ASG_NAME_PROD: incubator-test-bastion
AWS_REGION_PROD: us-west-1
jobs:
bastion:
name: Scale Bastion server
runs-on: ubuntu-latest
steps:
- name: Debug Action
uses: hmarr/[email protected]
- name: Interpolate Bastion capacity flag
id: bastion_capacity
run: |
echo "bastion_count=$(\
if [[ ${{ github.event.inputs.state }} == 'enable' ]]; then \
echo 1; \
else
echo 0; \
fi)" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION_PROD }}
- name: Scale up/down Bastion ASG
run: |
aws autoscaling update-auto-scaling-group \
--auto-scaling-group-name ${{ env.BASTION_ASG_NAME_PROD }} \
--desired-capacity ${{ env.bastion_count }}