|
6 | 6 | pull_request:
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - |
10 |
| - terraform_arcadia: |
11 |
| - name: "Arcadia WebApp" |
12 |
| - runs-on: ubuntu-latest |
13 |
| - needs: terraform_xc |
14 |
| - defaults: |
15 |
| - run: |
16 |
| - working-directory: ./arcadia |
17 |
| - steps: |
18 |
| - - name: Checkout |
19 |
| - uses: actions/checkout@v3 |
20 |
| - |
21 |
| - - name: Setup Terraform |
22 |
| - uses: hashicorp/setup-terraform@v2 |
23 |
| - with: |
24 |
| - cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} |
25 |
| - |
26 |
| - - name: Setup Terraform Backend |
27 |
| - id: backend |
28 |
| - run: | |
29 |
| - cat > backend.tf << EOF |
30 |
| - terraform { |
31 |
| - cloud { |
32 |
| - organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" |
33 |
| - workspaces { |
34 |
| - name = "${{ secrets.TF_CLOUD_WORKSPACE_ARCADIA }}" |
35 |
| - } |
36 |
| - } |
37 |
| - } |
38 |
| - EOF |
39 |
| - - name: Terraform Init |
40 |
| - id: init |
41 |
| - run: terraform init |
42 |
| - |
43 |
| - - name: Terraform Validate |
44 |
| - id: validate |
45 |
| - run: terraform validate -no-color |
46 |
| - |
47 |
| - - name: Terraform Plan |
48 |
| - id: plan |
49 |
| - if: github.event_name == 'pull_request' |
50 |
| - run: terraform plan -no-color -input=false |
51 |
| - continue-on-error: true |
52 |
| - |
53 |
| - - uses: actions/github-script@v6 |
54 |
| - if: github.event_name == 'pull_request' |
55 |
| - env: |
56 |
| - PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" |
57 |
| - with: |
58 |
| - github-token: ${{ secrets.GITHUB_TOKEN }} |
59 |
| - script: | |
60 |
| - const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` |
61 |
| - #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` |
62 |
| - #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` |
63 |
| - #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` |
64 |
| - <details><summary>Show Plan</summary> |
65 |
| - \`\`\`\n |
66 |
| - ${process.env.PLAN} |
67 |
| - \`\`\` |
68 |
| - </details> |
69 |
| - *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; |
70 |
| - github.rest.issues.createComment({ |
71 |
| - issue_number: context.issue.number, |
72 |
| - owner: context.repo.owner, |
73 |
| - repo: context.repo.repo, |
74 |
| - body: output |
75 |
| - }) |
76 |
| - - name: Terraform Plan Status |
77 |
| - if: steps.plan.outcome == 'failure' |
78 |
| - run: exit 1 |
79 |
| - |
80 |
| - - name: Terraform Destroy |
81 |
| - if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
82 |
| - run: terraform destroy -auto-approve -input=false |
83 | 9 |
|
84 | 10 | terraform_nap:
|
85 | 11 | name: "NGINX App Protect"
|
|
0 commit comments