-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 2.12 KB
/
deploy-apigw-vpce.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
name: deploy-apigw-vpce
on:
# push:
# paths:
# - .github/workflows/deploy-apigw-vpce.yaml
# - cfn/apigw-vpce.yaml
workflow_dispatch:
defaults:
run:
shell: bash
env:
ACCOUNT_A_DEPLOY_ROLE: arn:aws:iam::111111111111:role/gh-oidc-deploy # TODO account-A, vpce, lambda api tester
AWS_REGION: ap-southeast-2
STACK_BASENAME: k-cross-account-priv-apigw-demo
jobs:
deploy:
name: Deploy CFN stack
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run yamllint
run: yamllint -c ./.github/linters/.yaml-lint.yaml .github/workflows/*deploy-apigw-vpce.yaml cfn/apigw-vpce.yaml -f parsable
- name: Run cfn-lint
run: |
pip install cfn-lint~=0.61
cfn-lint cfn/apigw-vpce.yaml
- name: Set env.STACK_NAME_VPCE
run: echo "STACK_NAME_VPCE=${{ env.STACK_BASENAME }}-apigw-vpce" >> $GITHUB_ENV
- uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: ${{ env.AWS_REGION }}
role-duration-seconds: 900
role-skip-session-tagging: true
role-to-assume: ${{ env.ACCOUNT_A_DEPLOY_ROLE }}
- name: Deploy ${{ env.STACK_NAME_VPCE }} CFN stack to account A
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: ${{ env.STACK_NAME_VPCE }}
no-fail-on-empty-changeset: 1
template: cfn/apigw-vpce.yaml
tags: '[
{"Key": "Description", "Value": "Cross Account Private APIGW Demo"},
{"Key": "Project", "Value": "Cross Account Private APIGW Demo"},
{"Key": "Repository", "Value": "${{ github.repository }}"}
]'
- name: Set VPCE_ID to GITHUB_ENV
run: |
echo "VPCE_ID=$(aws cloudformation describe-stacks --stack-name ${{ env.STACK_NAME_VPCE }} --query 'Stacks[0].Outputs[?OutputKey==`VpcEndpointId`].OutputValue' --output text)" >> $GITHUB_ENV
- name: Add tags to VPC Endpoint
run: aws ec2 create-tags --resources ${{ env.VPCE_ID }} --tags Key=stack-name,Value=${{ env.STACK_NAME_VPCE }}