Skip to content

Commit d831cc0

Browse files
authored
Merge pull request #114 from sourcefuse/refactor/eks
EKS Refactor
2 parents e717936 + 7116e59 commit d831cc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3304
-2388
lines changed

.github/workflows/terraform-test.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
name: Terratest
3+
on: # yamllint disable-line rule:truthy
4+
pull_request:
5+
types: [opened]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: 'Pull Request Number'
10+
required: true
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
statuses: write # Required for setting commit status
16+
17+
jobs:
18+
terratest:
19+
runs-on: ubuntu-latest
20+
name: Terratest Checks
21+
22+
env:
23+
PR_NUMBER: >-
24+
${{ github.event_name == 'workflow_dispatch' &&
25+
github.event.inputs.pr_number || github.event.pull_request.number }}
26+
27+
28+
steps:
29+
- name: Checkout PR code
30+
uses: actions/checkout@v4
31+
with:
32+
ref: refs/pull/${{ env.PR_NUMBER }}/head
33+
34+
- name: Configure AWS credentials via OIDC
35+
uses: aws-actions/configure-aws-credentials@v4
36+
with:
37+
role-to-assume: ${{ secrets.ARC_IAC_TERRATEST_ROLE }}
38+
aws-region: us-east-1
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: '1.24'
44+
45+
- name: Set up Terraform
46+
uses: hashicorp/setup-terraform@v3
47+
with:
48+
terraform_version: 1.5.7
49+
terraform_wrapper: false
50+
51+
- name: Create test directory and download go from S3
52+
run: |
53+
mkdir -p terra-test
54+
aws s3 cp ${{ secrets.ARC_TERRATEST_GO_FILE }} terra-test/terra_test.go
55+
- name: Initialize Go module and install dependencies
56+
run: |
57+
cd terra-test
58+
ls
59+
go mod init terraform-test || true
60+
go get github.com/gruntwork-io/terratest/modules/terraform
61+
go get github.com/stretchr/testify/assert
62+
go mod tidy
63+
go test -v -timeout 40m
64+
- name: Report check status manually
65+
uses: actions/github-script@v7
66+
with:
67+
github-token: ${{ secrets.GITHUB_TOKEN }}
68+
script: |
69+
const pr_number = parseInt(process.env.PR_NUMBER);
70+
const pr = await github.rest.pulls.get({
71+
owner: context.repo.owner,
72+
repo: context.repo.repo,
73+
pull_number: pr_number,
74+
});
75+
const sha = pr.data.head.sha;
76+
await github.rest.repos.createCommitStatus({
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
sha: sha,
80+
state: 'success',
81+
context: 'terratest',
82+
description: 'Manual terratest completed successfully',
83+
target_url:
84+
`https://github.com/${context.repo.owner}/${context.repo.repo}` +
85+
`/actions/runs/${process.env.GITHUB_RUN_ID}`,
86+
});

.snyk

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
22
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
33
ignore:
4-
SNYK-CC-TF-94:
4+
SNYK-CC-TF-107:
55
- 'main.tf > *':
66
reason: >-
7-
The user of this module may specify an appropriate address range. The
8-
default is 0.0.0.0/0 (same as EKS default)
9-
SNYK-CC-K8S-48:
10-
- 'core-apps/metrics-server.yaml > *':
11-
reason: >-
12-
metric-server is a core component and is safe to install in kube system-namespace
13-
SNYK-CC-K8S-47:
14-
- 'core-apps/eks-dashboard-viewer-service-account.yaml > *':
15-
reason: >-
16-
The custom role only allows "get", "watch", "list" verbs on most resources that are
17-
displayed on kubernetes-dashboard. It only allows "list" on secrets.
18-
- 'core-apps/dashboard.yaml > *':
19-
reason: >-
20-
The the role is required as is by kubernetes dashboard to fetch the necessary metrics and details.
7+
Encryption for EKS secrets is managed externally using a custom KMS module.
218
version: v1.25.0
229
patch: {}
2310
exclude:

.terraform.lock.hcl

Lines changed: 48 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)