Skip to content

Commit

Permalink
feat: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
baolsen committed Sep 20, 2022
1 parent c7bdca2 commit a6dac44
Show file tree
Hide file tree
Showing 70 changed files with 2,350 additions and 139 deletions.
11 changes: 0 additions & 11 deletions .devcontainer/Dockerfile

This file was deleted.

56 changes: 46 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,60 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/ubuntu
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/docker-existing-dockerfile
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
"args": { "VARIANT": "ubuntu-22.04" }
"args": {
"VARIANT": "ubuntu-22.04"
}
},


// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",

// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../Dockerfile",

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

"forwardPorts": [3000],

// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",

"features": {
"terraform": "1.0",
"aws-cli": "latest"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"terraform.languageServer.args": [
"-port 3000"
],
"terraform.languageServer.tcp.port": 3000
},

"extensions": [
"hashicorp.terraform",
"redhat.vscode-yaml",
"ms-python.python",
"mutantdino.resourcemonitor"
],

// Hack for terraform-ls
// "postStartCommand": "nohup bash -c '/home/vscode/.vscode-server/extensions/hashicorp.terraform-2.24.1-linux-arm64/bin/terraform-ls serve -port 3000 &'"

}
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
max-line-length = 90
max-complexity = 10
exclude =
__pycache__
.venv
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
13 changes: 8 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Contributing

Contributions are welcome.

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.

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

1. Update the README.md with details of changes including example hcl blocks and [example files](./examples) if appropriate.
2. Run pre-commit hooks `pre-commit run -a`.
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.
2. Add appropriate tests.
3. Run pre-commit hooks `pre-commit run -a`.
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.

## Checklists for contributions

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

## Semantic Pull Requests

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

The `chore` prefix skipped during changelog generation. It can be used for `chore: update changelog` commit message by example.
The `chore` prefix skipped during changelog generation. It can be used for `chore: update changelog` commit message by example.
64 changes: 64 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: main

on: [workflow_dispatch, pull_request]

env:
AWS_REGION: eu-west-1
AWS_ROLE: cat-genrl-prd-infra-gh-tf-aws-github-runners

permissions:
id-token: write
contents: read

jobs:
python_lint:
name: 🐍 Python file formatting
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
flake8
black .
terraform_lint:
name: 🏗 Terraform file format
runs-on: self-hosted
steps:
- uses: hashicorp/setup-terraform@v2
- uses: dflook/terraform-fmt-check@v1
with:
path: .

testing:
needs: [python_lint, terraform_lint]
name: ✅ Testing
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ env.AWS_ROLE }}
role-duration-seconds: 3600
- uses: actions/setup-python@v2
- uses: hashicorp/setup-terraform@v2
- name: Install tests
run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pre-commit install
- name: Execute tests
run: |
source .venv/bin/activate
pre-commit run
pytest --run-id ${{ github.run_id }}
env:
PYTEST_ADDOPTS: "--color=yes"
timeout-minutes: 30
4 changes: 2 additions & 2 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: false
validateSingleCommit: false
78 changes: 0 additions & 78 deletions .github/workflows/pre-commit.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
release:
name: Release
runs-on: ubuntu-latest
runs-on: self-hosted
# Skip running release workflow on forks
if: github.repository_owner == 'cloudandthings'
steps:
Expand All @@ -37,4 +37,4 @@ jobs:
@semantic-release/[email protected]
[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 0 additions & 16 deletions .github/workflows/terraform.yml

This file was deleted.

19 changes: 17 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
*.tfstate
*.tfstate.*

# TF cache
.tfcache

# Crash log files
crash.log

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
#
terraform.tfvars
# terraform.tfvars

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

# Python
__pycache__

# Testing artefacts
tf_resources.json
test-rsa.*
.out
*.tar.gz

# VSCode
*.code-workspace
*.code-workspace

# Apple
.DS_Store
Loading

0 comments on commit a6dac44

Please sign in to comment.