-
Notifications
You must be signed in to change notification settings - Fork 8
188 lines (163 loc) · 6.45 KB
/
scoutsuite.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: ScoutSuite
on:
pull_request:
branches:
["main"]
push:
branches:
["main"]
jobs:
terraform-plan:
name: "Terraform Plan"
strategy:
matrix: { dir: ["samples/simple-build-pipeline"] }
environment: aws-ci
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.dir }}
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
## the following creates an ARN based on the values entered into github secrets
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
role-session-name: CGDToolkitGitHubActions
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Init
id: init
run: terraform init
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: |
terraform plan -detailed-exitcode -no-color -var="fully_qualified_domain_name=${{ secrets.CI_FULLY_QUALIFIED_DOMAIN_NAME }}" -out tf.plan
- name: Publish Terraform Plan
if: steps.plan.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: tfplan
path: ${{matrix.dir}}/tf.plan
terraform-apply:
name: "Terraform Apply"
strategy:
matrix: { dir: ["samples/simple-build-pipeline"] }
defaults:
run:
working-directory: ${{ matrix.dir }}
runs-on: ubuntu-latest
needs: terraform-plan
environment: aws-ci
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
## the following creates an ARN based on the values entered into github secrets
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
role-session-name: CGDToolkitGitHubActions
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init
# Download saved plan from artifacts
- name: Download Terraform Plan
uses: actions/download-artifact@v4
with:
name: tfplan
path: ${{matrix.dir}}/tf.plan
- name: Examine TF Plan
shell: bash
run: |
ls -la tf.plan
# Terraform Apply
- name: Terraform Apply
run: terraform apply -auto-approve tf.plan
scout-suite:
name: ScoutSuite
runs-on: ubuntu-latest
strategy:
matrix: { dir: ["samples/simple-build-pipeline"] }
environment: aws-ci
needs: terraform-apply
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
## the following creates an ARN based on the values entered into github secrets
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
role-session-name: CGDToolkitGitHubActions
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install ScoutSuite
run: pip install scoutsuite
- name: Run Scout
run: python3 scout.py aws
terraform-destroy:
name: "Terraform Destroy"
strategy:
matrix: { dir: ["samples/simple-build-pipeline"] }
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.dir }}
needs: scout-suite
environment: aws-ci
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
## the following creates an ARN based on the values entered into github secrets
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
role-session-name: CGDToolkitGitHubActions
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init
# Download saved plan from artifacts
- name: Download Terraform Plan
uses: actions/download-artifact@v4
with:
name: tfplan
path: ${{matrix.dir}}/tf.plan
- name: Examine TF Plan
shell: bash
run: |
ls -la tf.plan
# Terraform Apply
- name: Terraform Apply
run: terraform destroy -auto-approve tf.plan