Skip to content

Commit 3e2adb1

Browse files
committed
feat: add initial module
0 parents  commit 3e2adb1

29 files changed

+1616
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM mcr.microsoft.com/devcontainers/base:jammy
2+
3+
RUN apt update && apt install -y \
4+
vim
5+
6+
# install aws
7+
RUN SYSTEM_ARCH=$(uname -m) \
8+
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-${SYSTEM_ARCH}-2.13.33.zip" -o "awscliv2.zip" \
9+
&& unzip -qq awscliv2.zip \
10+
&& aws/install \
11+
&& aws --version \
12+
&& rm -rf aws
13+
14+
# install terraform
15+
ENV TERRAFORM_VERSION=1.6.6
16+
ENV TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
17+
RUN mkdir -p $TF_PLUGIN_CACHE_DIR
18+
RUN SYSTEM_ARCH=$(dpkg --print-architecture) \
19+
&& curl -OL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
20+
&& unzip terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
21+
&& mv terraform /usr/local/bin/ \
22+
&& terraform version \
23+
&& rm terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip
24+
25+
# install tflint
26+
RUN curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
27+
28+
# install pip
29+
RUN apt-get update
30+
RUN apt-get install -y \
31+
python3-pip \
32+
shellcheck
33+
34+
# install python packages
35+
RUN python3 -m pip install \
36+
boto3 \
37+
black
38+
39+
# verify installs
40+
RUN terraform --version
41+

.devcontainer/devcontainer.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "Terraform",
3+
"dockerFile": "Dockerfile",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2.7.1": {}
6+
},
7+
"mounts": [
8+
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
9+
"source=${localEnv:HOME}/.tsh,target=/home/vscode/.tsh,type=bind,consistency=cached"
10+
],
11+
"containerEnv": {
12+
"TF_PLUGIN_CACHE_DIR": "${containerWorkspaceFolder}/.devcontainer/tmp/.terraform.d/"
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"settings": {
17+
"editor.codeActionsOnSave": {
18+
"source.fixAll": true
19+
},
20+
"editor.formatOnSave": true,
21+
"editor.formatOnType": false,
22+
"editor.inlineSuggest.enabled": true,
23+
"terminal.integrated.shell.linux": "/bin/bash",
24+
"python.defaultInterpreterPath": "/usr/bin/python3",
25+
"[markdown]": {
26+
"editor.rulers": [
27+
80
28+
]
29+
},
30+
"[python]": {
31+
"editor.defaultFormatter": "ms-python.black-formatter"
32+
}
33+
},
34+
"extensions": [
35+
"darkriszty.markdown-table-prettify",
36+
"editorconfig.editorconfig",
37+
"github.copilot",
38+
"github.copilot-chat",
39+
"github.vscode-github-actions",
40+
"github.vscode-pull-request-github",
41+
"hashicorp.terraform",
42+
"ms-azuretools.vscode-docker",
43+
"ms-python.black-formatter",
44+
"timonwong.shellcheck",
45+
"VisualStudioExptTeam.vscodeintellicode"
46+
]
47+
}
48+
}
49+
}

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[*]
2+
indent_style = space
3+
indent_size = 2
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[{Dockerfile,Dockerfile.*}]
10+
indent_size = 4
11+
tab_width = 4
12+
13+
[{Makefile,makefile,GNUmakefile}]
14+
indent_style = tab
15+
indent_size = 4
16+
17+
[Makefile.*]
18+
indent_style = tab
19+
indent_size = 4
20+
21+
[**/*.{go,mod,sum}]
22+
indent_style = tab
23+
indent_size = unset
24+
25+
[**/*.py]
26+
indent_size = 4

.github/.dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v3
17+
- name: Bump Version
18+
id: tag_version
19+
uses: mathieudutour/github-tag-action@v6.1
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
default_bump: minor
23+
custom_release_rules: bug:patch:Fixes,chore:patch:Chores,docs:patch:Documentation,feat:minor:Features,refactor:minor:Refactors,test:patch:Tests,ci:patch:Development,dev:patch:Development
24+
- name: Create Release
25+
uses: ncipollo/release-action@v1.12.0
26+
with:
27+
tag: ${{ steps.tag_version.outputs.new_tag }}
28+
name: ${{ steps.tag_version.outputs.new_tag }}
29+
body: ${{ steps.tag_version.outputs.changelog }}

.github/workflows/semantic-check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: semantic-check
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
jobs:
14+
main:
15+
name: Semantic Commit Message Check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v3
20+
- uses: amannn/action-semantic-pull-request@v5.2.0
21+
name: Check PR for Semantic Commit Message
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
with:
25+
requireScope: false
26+
validateSingleCommit: true

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v3
14+
- name: Terraform Setup
15+
run: |
16+
terraform init
17+
- name: Lint Terraform
18+
uses: reviewdog/action-tflint@master
19+
with:
20+
github_token: ${{ secrets.github_token }}
21+
filter_mode: "nofilter"

.gitignore

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# .gitignore
2+
3+
# terraform files
4+
.terraform.lock.hcl
5+
.terraform.tfstate.lock.info
6+
*.tfvars.hcl
7+
*.tfstate
8+
*.tfstate.*.backup
9+
*.tfstate.backup
10+
*.tfplan
11+
*.terraform/
12+
*.tfvars
13+
.grunt
14+
15+
# node.js / typescript
16+
node_modules
17+
npm-debug.log
18+
yarn-error.log
19+
dist
20+
out
21+
*.tsbuildinfo
22+
23+
# logs
24+
logs
25+
*.log
26+
npm-debug.log*
27+
yarn-debug.log*
28+
yarn-error.log*
29+
30+
# runtime data
31+
pids
32+
*.pid
33+
*.seed
34+
*.pid.lock
35+
36+
# coverage directories
37+
coverage
38+
lib-cov
39+
40+
# docker files
41+
*.tar
42+
dockerfile.*.bak
43+
44+
# general
45+
tmp/
46+
!**/.gitkeep
47+
.DS_Store
48+
.env
49+
.env.local
50+
.env.development.local
51+
.env.test.local
52+
.env.production.local
53+
54+
# ides
55+
.vscode
56+
.idea
57+
*.swp
58+
*.swo
59+
60+
# opa
61+
bundle.tar.gz
62+

CONTRIBUTING.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Contributing
2+
3+
We welcome contributions to the project. This document provides information and
4+
guidelines for contributing.
5+
6+
## Development Environment
7+
8+
This repository includes a configuration for a development container using the
9+
[VS Code Remote - Containers extension](https://code.visualstudio.com/docs/remote/containers).
10+
This setup allows you to develop within a Docker container that already has all
11+
the necessary tools and dependencies installed.
12+
13+
The development container is based on Ubuntu 22.04 (Jammy) and includes the
14+
following tools:
15+
16+
- AWS CLI
17+
- Python v3.8
18+
- Python Packages: `boto3`, `black`
19+
- Docker CLI
20+
- Shellcheck
21+
- Terraform
22+
23+
### Prerequisites
24+
25+
- [Docker](https://www.docker.com/products/docker-desktop) installed on your
26+
local machine.
27+
- [Visual Studio Code](https://code.visualstudio.com/) installed on your
28+
local machine.
29+
- [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
30+
for Visual Studio Code.
31+
32+
### Usage
33+
34+
1. Clone and open this repository:
35+
36+
```bash
37+
git clone https://github.com/cruxstack/terraform-aws-teleport-cluster.git
38+
code terraform-aws-teleport-cluster
39+
```
40+
41+
2. When prompted to "Reopen in Container", click "Reopen in Container". This
42+
will start building the Docker image for the development container. If you're
43+
not prompted, you can open the Command Palette (F1 or Ctrl+Shift+P), and run
44+
the "Remote-Containers: Reopen Folder in Container" command.
45+
46+
3. After the development container is built and started, you can use the
47+
Terminal in Visual Studio Code to interact with the container. All commands
48+
you run in the Terminal will be executed inside the container.
49+
50+
### Troubleshooting
51+
52+
If you encounter any issues while using the development container, you can try
53+
rebuilding the container. To do this, open the Command Palette and run the
54+
"Remote-Containers: Rebuild Container" command.
55+
56+
## Contribution Guidelines
57+
58+
We appreciate your interest in contributing to the project. Here are some
59+
guidelines to help ensure your contributions are accepted.
60+
61+
### Issues
62+
63+
- Use the GitHub issue tracker to report bugs or propose new features.
64+
- Before submitting a new issue, please search to make sure it has not already
65+
been reported. If it has, add a comment to the existing issue instead of
66+
creating a new one.
67+
- When reporting a bug, include as much detail as you can. Include the version
68+
of the module you're using, what you expected to happen, what actually
69+
happened, and steps to reproduce the bug.
70+
71+
### Pull Requests
72+
73+
- Submit your changes as a pull request.
74+
- All pull requests should be associated with an issue. If your change isn't
75+
associated with an existing issue, please create one before submitting a pull
76+
request.
77+
- In your pull request, include a summary of the changes, the issue number it
78+
resolves, and any additional information that might be helpful for
79+
understanding your changes.
80+
- Make sure your changes do not break any existing functionality. If your
81+
changes require updates to existing tests or the addition of new ones, include
82+
those in your pull request.
83+
- Follow the existing code style. We use a linter to maintain code quality, so
84+
make sure your changes pass the linter checks.
85+
86+
Thank you for your contributions!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 CruxStack LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)