Skip to content

Commit 2144880

Browse files
committed
Changes for testing
1 parent 2876723 commit 2144880

7 files changed

+196
-77
lines changed

.github/dependabot.yml

-15
This file was deleted.

.github/workflows/changelog.yaml

+39-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
1-
name: "Changelog"
1+
name: Changelog CI
22

33
on:
44
push:
55
branches:
6-
- "release/**"
6+
- 'release/**'
77
paths-ignore:
8-
- "**.md"
8+
- "*.md"
9+
create:
10+
11+
workflow_call:
912
workflow_dispatch:
1013

1114
jobs:
12-
call-workflow:
13-
uses: jivygroup/om2-github-workflows/.github/workflows/changelog.yaml@main
14-
secrets: inherit
15+
generate-changelog:
16+
if: contains(github.ref, 'release/')
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Install GitVersion
25+
uses: gittools/actions/gitversion/[email protected]
26+
with:
27+
versionSpec: "5.12.0"
28+
29+
- name: Determine Version
30+
id: gitversion
31+
uses: gittools/actions/gitversion/[email protected]
32+
33+
- name: Run Changelog CI
34+
uses: saadmk11/[email protected]
35+
with:
36+
config_file: .github/config/changelog-config.yaml
37+
release_version: ${{ steps.gitversion.outputs.majorMinorPatch }}
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Notify Slack
41+
if: failure()
42+
uses: act10ns/slack@v2
43+
env:
44+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
45+
with:
46+
status: ${{ job.status }}
47+
channel: "#phoenix-builds"

.github/workflows/release.yaml

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1-
name: "Release"
1+
name: Create Release
22

33
on:
44
push:
55
tags:
66
- "*"
7+
workflow_call:
8+
workflow_dispatch:
79

810
jobs:
9-
call-workflow:
10-
uses: jivygroup/om2-github-workflows/.github/workflows/release.yaml@main
11-
secrets: inherit
11+
create_release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Create GitHub Release
18+
id: create_release
19+
uses: actions/create-release@v1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
tag_name: ${{ github.ref }}
24+
release_name: Release ${{ github.ref }}
25+
draft: false
26+
prerelease: false
+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: "Terraform Checks"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
- release/*
9+
pull_request:
10+
branches: [main, develop, release/*]
11+
types: [opened, labeled, synchronize]
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: false
21+
22+
jobs:
23+
terraform-format:
24+
name: "Terraform Code Format Checks"
25+
runs-on: large-ubuntu-latest
26+
timeout-minutes: 1
27+
defaults:
28+
run:
29+
working-directory: ${{ inputs.working-directory }}
30+
31+
steps:
32+
- name: Check out the repo
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Setup Terraform
38+
uses: hashicorp/setup-terraform@v3
39+
with:
40+
terraform_version: ${{ vars.TF_VERSION }}
41+
terraform_wrapper: false
42+
43+
- name: Terraform Format
44+
id: fmt
45+
run: terraform fmt -check
46+
47+
terrascan:
48+
name: "Terrascan"
49+
runs-on: large-ubuntu-latest
50+
timeout-minutes: 2
51+
52+
steps:
53+
- name: Check out the repo
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
58+
- name: Run Terrascan
59+
id: terrascan
60+
uses: tenable/terrascan-action@main
61+
with:
62+
iac_dir: ${{ inputs.working-directory }}
63+
iac_type: "terraform"
64+
iac_version: "v14"
65+
policy_type: "aws"
66+
only_warn: true
67+
sarif_upload: true
68+
#scm_token: ${{ secrets.ACCESS_TOKEN }}
69+
#verbose: true
70+
#non_recursive:
71+
#policy_path:
72+
#skip_rules:
73+
#config_path:
74+
#find_vulnerabilities:
75+
#webhook_url:
76+
#webhook_token:
77+
78+
checkov:
79+
name: "Checkov"
80+
runs-on: large-ubuntu-latest
81+
timeout-minutes: 2
82+
83+
steps:
84+
- name: Check out the repo
85+
uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 0
88+
89+
- name: Run Checkov action
90+
id: checkov
91+
uses: bridgecrewio/checkov-action@master
92+
with:
93+
directory: ${{ inputs.working-directory }}
94+
quiet: true # optional: display only failed checks
95+
soft_fail: true # optional: do not return an error code if there are failed checks
96+
framework: terraform # optional: run only on a specific infrastructure {cloudformation,terraform,kubernetes,all}
97+
output_format: sarif # optional: the output format, one of: cli, json, junitxml, github_failed_only, or sarif. Default: sarif
98+
download_external_modules: true # optional: download external terraform modules from public git repositories and terraform registry
99+
log_level: DEBUG # optional: set log level. Default WARNING
100+
container_user: 1000 # optional: Define what UID and / or what GID to run the container under to prevent permission issues
101+
skip_check: CKV_TF_1,CKV2_AWS_5 # optional: skip a specific check_id. can be comma separated list
102+
#file: example/tfplan.json # optional: provide the path for resource to be scanned. This will override the directory if both are provided.
103+
#check: CKV_AWS_1 # optional: run only a specific check_id. can be comma separated list
104+
#config_file: path/this_file
105+
#baseline: cloudformation/.checkov.baseline # optional: Path to a generated baseline file. Will only report results not in the baseline.
106+
107+
docs:
108+
runs-on: large-ubuntu-latest
109+
if: contains(github.ref, 'pull')
110+
steps:
111+
- name: Checkout
112+
uses: actions/checkout@v4
113+
with:
114+
ref: ${{ github.event.pull_request.head.ref }}
115+
116+
- name: Render terraform docs inside the README.md and push changes back to PR branch
117+
uses: terraform-docs/gh-actions@v1
118+
with:
119+
working-dir: ${{ inputs.working-directory }}
120+
git-push: "true"
121+
git-commit-message: "[skip ci] terraform-docs: Update READMEs"
122+
git-push-sign-off: true
123+

.github/workflows/terraform.yaml

-27
This file was deleted.

README.md

+13-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
1-
# om2-terraform-template
1+
# om2-candidate
22

3-
A repo for a terraform-based repos.
3+
Welcome to OM2.
4+
This repo holds the candidate excercise to help us guage technical profficiency.
45

5-
## Usage
6+
## Excercise
67

7-
This repository is intended to be used as a template for other Terraform repositories. To use it:
8-
9-
- Either click the "Use this template" button above, or select the template in the New Repository template selection drop-down.
10-
- Ensure to select to use only the default branch and NOT ALL branches.
11-
- Please note that only Code Owners can create repositories for purposes of coinsistency.
12-
- This will create a new repository in your account with the same files and directory structure as this one.
13-
- Configure the repository settings as needed:
14-
- Add colaborators by teams ONLY. No individual users should be added as collaborators.
15-
- Add branch protection policies to develop and main branches. (might already exist)
16-
- You can then clone that repository to your local machine and start working on it.
17-
- Once cloned create Main branch and push it
18-
- Create an initial tag (like 0.0.1) and push it to create initial release so that ChangeLog workflow will have a starting point to work with.
19-
- Create first PR and start coding
20-
- Ensure to change all references to names
21-
22-
## Best Practices for New Repositories
23-
24-
- Ensure to update the Readme.md file with the appropriate information for the repository.
25-
- Create an example in the examples folder that can be used for testing.
8+
- Implement the terraform code for the simplest possible EKS cluster with a single t3.micro node.
9+
- Implement a github workflow that will run `terraform plan` and `terraform apply` on every push to the main branch or a PR against develop.
10+
- Use pre-commit to ensure code standards are met.
11+
- Document your changes
12+
- Use `terraform test` framework to write a simple test of something in the code
13+
- Check if there are any Terraform versions that should be updated in the codebase
14+
- If possible create the cluster
15+
- Once you have a cluster install some community helm chart on it.
2616

2717

2818
<!-- BEGIN_TF_DOCS -->
@@ -49,4 +39,4 @@ No inputs.
4939
## Outputs
5040

5141
No outputs.
52-
<!-- END_TF_DOCS -->
42+
<!-- END_TF_DOCS -->

pre-commit.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ param (
66
$TestNamesRegex = "null"
77
)
88

9-
$TAG = "latest"
9+
$TAG = "main"
1010
docker run --rm -v ${pwd}:/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
1111

1212
$tests = Get-ChildItem -Recurse -Filter '*.tftest.hcl' -File | Sort-Object
@@ -28,7 +28,7 @@ $tests | ForEach-Object -Parallel {
2828
}
2929
Write-Output "Running test: $($_.FullName)"
3030
terraform init -upgrade
31-
terraform validate
31+
terraform validate -force
3232
terraform test
3333
$currentLocation = Get-Location
3434
if ($currentLocation -ne $startingLocation) {

0 commit comments

Comments
 (0)