Skip to content

Commit a6dac44

Browse files
committed
feat: Initial commit
1 parent c7bdca2 commit a6dac44

Some content is hidden

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

70 files changed

+2350
-139
lines changed

.devcontainer/Dockerfile

-11
This file was deleted.

.devcontainer/devcontainer.json

+46-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,60 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/ubuntu
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/docker-existing-dockerfile
33
{
4-
"name": "Ubuntu",
54
"build": {
65
"dockerfile": "Dockerfile",
76
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
87
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
9-
"args": { "VARIANT": "ubuntu-22.04" }
8+
"args": {
9+
"VARIANT": "ubuntu-22.04"
10+
}
1011
},
11-
12+
13+
// Sets the run context to one level up instead of the .devcontainer folder.
14+
"context": "..",
15+
16+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
17+
"dockerFile": "../Dockerfile",
18+
1219
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13-
// "forwardPorts": [],
14-
15-
// Use 'postCreateCommand' to run commands after the container is created.
16-
// "postCreateCommand": "uname -a",
17-
20+
"forwardPorts": [3000],
21+
22+
// Uncomment the next line to run commands after the container is created - for example installing curl.
23+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
24+
25+
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
26+
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
27+
28+
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
29+
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
30+
1831
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
1932
"remoteUser": "vscode",
33+
2034
"features": {
2135
"terraform": "1.0",
2236
"aws-cli": "latest"
23-
}
37+
},
38+
39+
// Set *default* container specific settings.json values on container create.
40+
"settings": {
41+
"python.linting.pylintEnabled": false,
42+
"python.linting.flake8Enabled": true,
43+
"python.linting.enabled": true,
44+
"terraform.languageServer.args": [
45+
"-port 3000"
46+
],
47+
"terraform.languageServer.tcp.port": 3000
48+
},
49+
50+
"extensions": [
51+
"hashicorp.terraform",
52+
"redhat.vscode-yaml",
53+
"ms-python.python",
54+
"mutantdino.resourcemonitor"
55+
],
56+
57+
// Hack for terraform-ls
58+
// "postStartCommand": "nohup bash -c '/home/vscode/.vscode-server/extensions/hashicorp.terraform-2.24.1-linux-arm64/bin/terraform-ls serve -port 3000 &'"
59+
2460
}

.flake8

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
max-line-length = 90
3+
max-complexity = 10
4+
exclude =
5+
__pycache__
6+
.venv

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
*.{cmd,[cC][mM][dD]} text eol=crlf
3+
*.{bat,[bB][aA][tT]} text eol=crlf

.github/CONTRIBUTING.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Contributing
22

3+
Contributions are welcome.
4+
35
When contributing to this repository, please first discuss the change you wish to make via issue,
46
email, or any other method with the owners of this repository before making a change.
57

@@ -8,15 +10,16 @@ Please note we have a code of conduct, please follow it in all your interactions
810
## Pull Request Process
911

1012
1. Update the README.md with details of changes including example hcl blocks and [example files](./examples) if appropriate.
11-
2. Run pre-commit hooks `pre-commit run -a`.
12-
3. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release. The terraform-aws-vpc maintainers take care of updating the CHANGELOG as they merge.
13+
2. Add appropriate tests.
14+
3. Run pre-commit hooks `pre-commit run -a`.
15+
4. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release. The terraform-aws-vpc maintainers take care of updating the CHANGELOG as they merge.
1316

1417
## Checklists for contributions
1518

1619
- [ ] Add [semantics prefix](#semantic-pull-requests) to your PR or Commits (at least one of your commit groups)
1720
- [ ] CI tests are passing
18-
- [ ] README.md has been updated after any changes to variables and outputs. See https://github.com/cloudandthings/terraform-aws-clickops-notifer/#doc-generation
19-
- [ ] ~~Run pre-commit hooks `pre-commit run -a`~~ TODO
21+
- [ ] README.md has been updated after any changes to variables and outputs.
22+
- [ ] Run pre-commit hooks `pre-commit run -a`
2023

2124
## Semantic Pull Requests
2225

@@ -31,4 +34,4 @@ To generate changelog, Pull Requests or Commits must have semantic and must foll
3134
- `ci:` for CI purpose
3235
- `chore:` for chores stuff
3336

34-
The `chore` prefix skipped during changelog generation. It can be used for `chore: update changelog` commit message by example.
37+
The `chore` prefix skipped during changelog generation. It can be used for `chore: update changelog` commit message by example.

.github/workflows/main.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: main
2+
3+
on: [workflow_dispatch, pull_request]
4+
5+
env:
6+
AWS_REGION: eu-west-1
7+
AWS_ROLE: cat-genrl-prd-infra-gh-tf-aws-github-runners
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
python_lint:
15+
name: 🐍 Python file formatting
16+
runs-on: self-hosted
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-python@v2
20+
- run: |
21+
python -m venv .venv
22+
source .venv/bin/activate
23+
pip install -r requirements.txt
24+
flake8
25+
black .
26+
27+
terraform_lint:
28+
name: 🏗 Terraform file format
29+
runs-on: self-hosted
30+
steps:
31+
- uses: hashicorp/setup-terraform@v2
32+
- uses: dflook/terraform-fmt-check@v1
33+
with:
34+
path: .
35+
36+
testing:
37+
needs: [python_lint, terraform_lint]
38+
name: ✅ Testing
39+
runs-on: self-hosted
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: aws-actions/configure-aws-credentials@v1
43+
with:
44+
aws-region: ${{ env.AWS_REGION }}
45+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
46+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47+
role-to-assume: ${{ env.AWS_ROLE }}
48+
role-duration-seconds: 3600
49+
- uses: actions/setup-python@v2
50+
- uses: hashicorp/setup-terraform@v2
51+
- name: Install tests
52+
run: |
53+
python -m venv .venv
54+
source .venv/bin/activate
55+
pip install -r requirements.txt
56+
pre-commit install
57+
- name: Execute tests
58+
run: |
59+
source .venv/bin/activate
60+
pre-commit run
61+
pytest --run-id ${{ github.run_id }}
62+
env:
63+
PYTEST_ADDOPTS: "--color=yes"
64+
timeout-minutes: 30

.github/workflows/pr-title.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
main:
1212
name: Validate PR title
13-
runs-on: ubuntu-latest
13+
runs-on: self-hosted
1414
steps:
1515
# Please look up the latest version from
1616
# https://github.com/amannn/action-semantic-pull-request/releases
@@ -49,4 +49,4 @@ jobs:
4949
# will suggest using that commit message instead of the PR title for the
5050
# merge commit, and it's easy to commit this by mistake. Enable this option
5151
# to also validate the commit message for one commit PRs.
52-
validateSingleCommit: false
52+
validateSingleCommit: false

.github/workflows/pre-commit.yml

-78
This file was deleted.

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
jobs:
1818
release:
1919
name: Release
20-
runs-on: ubuntu-latest
20+
runs-on: self-hosted
2121
# Skip running release workflow on forks
2222
if: github.repository_owner == 'cloudandthings'
2323
steps:
@@ -37,4 +37,4 @@ jobs:
3737
@semantic-release/[email protected]
3838
3939
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/terraform.yml

-16
This file was deleted.

.gitignore

+17-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
*.tfstate
66
*.tfstate.*
77

8+
# TF cache
9+
.tfcache
10+
811
# Crash log files
912
crash.log
1013

1114
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
1215
# .tfvars files are managed as part of configuration and so should be included in
1316
# version control.
1417
#
15-
terraform.tfvars
18+
# terraform.tfvars
1619

1720
# Ignore override files as they are usually used to override resources locally and so
1821
# are not checked in
@@ -29,5 +32,17 @@ override.tf.json
2932
# example: *tfplan*
3033
.terraform.lock.hcl
3134

35+
# Python
36+
__pycache__
37+
38+
# Testing artefacts
39+
tf_resources.json
40+
test-rsa.*
41+
.out
42+
*.tar.gz
43+
3244
# VSCode
33-
*.code-workspace
45+
*.code-workspace
46+
47+
# Apple
48+
.DS_Store

0 commit comments

Comments
 (0)