-
Notifications
You must be signed in to change notification settings - Fork 19
64 lines (55 loc) · 1.85 KB
/
deploy-cdktf-stacks.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
53
54
55
56
57
58
59
60
61
62
63
64
name: "Deploy CDKTF Stack"
on:
workflow_call:
inputs:
stacks:
required: true
description: JSON-stringified list of stacks to deploy, e.g. # [{ "stack": "my-stack" }]
type: string
upgrade-repositories:
required: true
type: boolean
jobs:
terraform:
name: "Terraform CDK Deploy"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJSON(inputs.stacks)}}
max-parallel: 10
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
with:
terraform_version: 1.9.8
cli_config_credentials_token: ${{ secrets.TF_CLOUD_TOKEN }}
terraform_wrapper: false
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "18"
- name: Install
run: yarn install
- name: Deploy
run: "$(yarn bin)/cdktf deploy --auto-approve '${{ matrix.stack }}'"
env:
TERRAFORM_CLOUD_TOKEN: ${{ secrets.TF_CLOUD_TOKEN }}
CDKTF_LOG_LEVEL: all
- name: Send failures to Slack
if: ${{ failure() && !cancelled() }}
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with:
payload: |
{
"provider_name": "stack deploy ${{ matrix.stack }}",
"run_url": "https://github.com/cdktf/cdktf-repository-manager/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.FAILURE_SLACK_WEBHOOK_URL }}
upgrade:
if: inputs.upgrade-repositories
needs:
- terraform
uses: ./.github/workflows/upgrade-repositories.yml
secrets: inherit