|
1 | | -name: 'Terraform GitHub Actions' |
| 1 | +name: Terraform GitHub Actions |
2 | 2 | on: |
3 | 3 | pull_request: |
4 | 4 | branches: |
5 | 5 | - master |
6 | | - |
7 | 6 | jobs: |
8 | 7 | fmt: |
9 | | - name: 'terraform fmt' |
| 8 | + name: terraform fmt |
10 | 9 | runs-on: ubuntu-latest |
11 | 10 | steps: |
12 | | - - name: 'Checkout' |
| 11 | + - name: Create GitHub App token |
| 12 | + id: github-app-token |
| 13 | + uses: actions/create-github-app-token@v2 |
| 14 | + with: |
| 15 | + app-id: ${{ secrets.InsiderActionsApplication_APP_ID }} |
| 16 | + private-key: ${{ secrets.InsiderActionsApplication_PRIVATE_KEY }} |
| 17 | + - name: Checkout |
13 | 18 | |
14 | | - |
15 | | - - name: 'Terraform Format' |
16 | | - uses: 'clouddrove/[email protected]' |
| 19 | + - name: Terraform Format |
| 20 | + uses: clouddrove/[email protected] |
17 | 21 | with: |
18 | | - actions_subcommand: 'fmt' |
19 | | - - name: 'Terraform Format' |
20 | | - uses: 'clouddrove/[email protected]' |
| 22 | + actions_subcommand: fmt |
| 23 | + - name: Terraform Format |
| 24 | + uses: clouddrove/[email protected] |
21 | 25 | with: |
22 | | - actions_subcommand: 'fmt' |
23 | | - |
| 26 | + actions_subcommand: fmt |
24 | 27 | basic: |
25 | | - name: 'basic' |
| 28 | + name: basic |
26 | 29 | runs-on: ubuntu-latest |
27 | 30 | steps: |
28 | | - - name: 'Checkout' |
| 31 | + - name: Create GitHub App token |
| 32 | + id: github-app-token |
| 33 | + uses: actions/create-github-app-token@v2 |
| 34 | + with: |
| 35 | + app-id: ${{ secrets.InsiderActionsApplication_APP_ID }} |
| 36 | + private-key: ${{ secrets.InsiderActionsApplication_PRIVATE_KEY }} |
| 37 | + - name: Checkout |
29 | 38 | |
30 | | - |
31 | | - - name: 'Configure AWS Credentials' |
| 39 | + - name: Configure AWS Credentials |
32 | 40 | uses: clouddrove/configure-aws-credentials@v1 |
33 | 41 | with: |
34 | 42 | aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} |
35 | 43 | aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} |
36 | 44 | aws-region: us-east-2 |
37 | | - |
38 | | - - name: 'Terraform init for basic' |
39 | | - uses: 'clouddrove/[email protected]' |
| 45 | + - name: Terraform init for basic |
| 46 | + uses: clouddrove/[email protected] |
40 | 47 | with: |
41 | | - actions_subcommand: 'init' |
| 48 | + actions_subcommand: init |
42 | 49 | tf_actions_working_dir: ./_example/basic |
43 | | - |
44 | | - - name: 'Terraform validate for basic' |
45 | | - uses: 'clouddrove/[email protected]' |
| 50 | + - name: Terraform validate for basic |
| 51 | + uses: clouddrove/[email protected] |
46 | 52 | with: |
47 | | - actions_subcommand: 'validate' |
| 53 | + actions_subcommand: validate |
48 | 54 | tf_actions_working_dir: ./_example/basic |
49 | | - |
50 | | - - name: 'Terraform plan for basic' |
51 | | - uses: 'clouddrove/[email protected]' |
| 55 | + - name: Terraform plan for basic |
| 56 | + uses: clouddrove/[email protected] |
52 | 57 | with: |
53 | | - actions_subcommand: 'plan' |
| 58 | + actions_subcommand: plan |
54 | 59 | tf_actions_working_dir: ./_example/basic |
55 | | - |
56 | 60 | complete: |
57 | | - name: 'complete' |
| 61 | + name: complete |
58 | 62 | runs-on: ubuntu-latest |
59 | 63 | steps: |
60 | | - - name: 'Checkout' |
| 64 | + - name: Create GitHub App token |
| 65 | + id: github-app-token |
| 66 | + uses: actions/create-github-app-token@v2 |
| 67 | + with: |
| 68 | + app-id: ${{ secrets.InsiderActionsApplication_APP_ID }} |
| 69 | + private-key: ${{ secrets.InsiderActionsApplication_PRIVATE_KEY }} |
| 70 | + - name: Checkout |
61 | 71 | |
62 | | - |
63 | | - - name: 'Configure AWS Credentials' |
| 72 | + - name: Configure AWS Credentials |
64 | 73 | uses: clouddrove/configure-aws-credentials@v1 |
65 | 74 | with: |
66 | 75 | aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} |
67 | 76 | aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} |
68 | 77 | aws-region: us-east-2 |
69 | | - |
70 | | - - name: 'Terraform init for complete' |
71 | | - uses: 'clouddrove/[email protected]' |
| 78 | + - name: Terraform init for complete |
| 79 | + uses: clouddrove/[email protected] |
72 | 80 | with: |
73 | | - actions_subcommand: 'init' |
| 81 | + actions_subcommand: init |
74 | 82 | tf_actions_working_dir: ./_example/complete |
75 | | - |
76 | | - - name: 'Terraform validate complete' |
77 | | - uses: 'clouddrove/[email protected]' |
| 83 | + - name: Terraform validate complete |
| 84 | + uses: clouddrove/[email protected] |
78 | 85 | with: |
79 | | - actions_subcommand: 'validate' |
| 86 | + actions_subcommand: validate |
80 | 87 | tf_actions_working_dir: ./_example/complete |
81 | | - |
82 | | - |
83 | 88 | pre-commit: |
84 | | - name: 'Pre-Commit' |
| 89 | + name: Pre-Commit |
85 | 90 | needs: |
86 | 91 | - fmt |
87 | 92 | - basic |
88 | 93 | - complete |
89 | 94 | runs-on: ubuntu-latest |
90 | 95 | steps: |
91 | | - - name: 'Checkout' |
| 96 | + - name: Create GitHub App token |
| 97 | + id: github-app-token |
| 98 | + uses: actions/create-github-app-token@v2 |
| 99 | + with: |
| 100 | + app-id: ${{ secrets.InsiderActionsApplication_APP_ID }} |
| 101 | + private-key: ${{ secrets.InsiderActionsApplication_PRIVATE_KEY }} |
| 102 | + - name: Checkout |
92 | 103 | |
93 | | - |
94 | | - - name: 'Install Tflint' |
| 104 | + - name: Install Tflint |
95 | 105 | run: | |
96 | 106 | curl https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash |
97 | | -
|
98 | | - - name: 'Pre-Commit 🔎' |
| 107 | + - name: Pre-Commit 🔎 |
99 | 108 | uses: pre-commit/[email protected] |
100 | 109 | continue-on-error: true |
101 | | - |
102 | | - - name: 'Slack Notification' |
| 110 | + - name: Slack Notification |
103 | 111 | uses: clouddrove/action-slack@v2 |
104 | 112 | with: |
105 | 113 | status: ${{ job.status }} |
106 | 114 | fields: repo,author |
107 | | - author_name: 'CloudDrove' |
| 115 | + author_name: CloudDrove |
108 | 116 | env: |
109 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required |
110 | | - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required |
| 117 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 118 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} |
111 | 119 | if: always() |
0 commit comments