Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtoj committed Jul 30, 2023
0 parents commit 18bb6b5
Show file tree
Hide file tree
Showing 23 changed files with 1,203 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mcr.microsoft.com/devcontainers/base:jammy

# install aws
RUN apt-get update && \
apt-get install -y unzip python3-pip && \
pip3 install --no-cache-dir --upgrade awscli && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# install terraform
ENV TERRAFORM_VERSION=1.5.1
ENV TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
RUN SYSTEM_ARCH=$(dpkg --print-architecture) \
&& mkdir -p $TF_PLUGIN_CACHE_DIR \
&& curl -OL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
&& unzip terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
&& mv terraform /usr/local/bin/ \
&& terraform version \
&& rm terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip

# verify installs
RUN terraform --version \
&& aws --version
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Terraform",
"dockerFile": "Dockerfile",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2.0.1": {},
},
"mounts": [
"source=${localEnv:HOME}/.aws,target=${env:HOME}/.aws,type=bind,consistency=cached"
],
"containerEnv": {
"TF_PLUGIN_CACHE_DIR": "/workspaces/terraform-aws-vpc-network/.devcontainer/tmp/.terraform.d/"
},
"customizations": {
"vscode": {
"settings": {
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"editor.formatOnSave": true,
"editor.formatOnType": false,
"editor.inlineSuggest.enabled": true,
"terminal.integrated.shell.linux": "/bin/bash",
"[markdown]": {
"editor.rulers": [
80
]
}
},
"extensions": [
"darkriszty.markdown-table-prettify",
"editorconfig.editorconfig",
"github.copilot",
"github.copilot-chat",
"github.vscode-github-actions",
"hashicorp.terraform",
"VisualStudioExptTeam.vscodeintellicode",
],
}
},
}
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[{Dockerfile,Dockerfile.*}]
indent_size = 4
tab_width = 4

[{Makefile,makefile,GNUmakefile}]
indent_style = tab
indent_size = 4

[Makefile.*]
indent_style = tab
indent_size = 4

[**/*.{go,mod,sum}]
indent_style = tab
indent_size = unset

[**/*.py]
indent_size = 4
6 changes: 6 additions & 0 deletions .github/.dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

on:
push:
branches:
- main

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version: 18
- name: Tests for auth-at-edge
run: |
cd assets/cf-mw-auth
npm install
npm test
- name: Tests for url-rewriter
run: |
cd assets/cf-mw-urlrewrite
npm install
npm test
- name: Bump Version
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor
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
- name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
26 changes: 26 additions & 0 deletions .github/workflows/semantic-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: semantic-check
on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
contents: read
pull-requests: read

jobs:
main:
name: Semantic Commit Message Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: amannn/action-semantic-pull-request@v5.2.0
name: Check PR for Semantic Commit Message
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: false
validateSingleCommit: true
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version: 18
- name: Tests for auth-at-edge
run: |
cd assets/cf-mw-auth
npm install
npm test
- name: Tests for url-rewriter
run: |
cd assets/cf-mw-urlrewrite
npm install
npm test
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# .gitignore

# terraform files
.terraform.lock.hcl
.terraform.tfstate.lock.info
*.tfstate
*.tfstate.*.backup
*.tfstate.backup
*.tfplan
*.terraform/
*.tfvars
.grunt

# node.js / typescript
node_modules
npm-debug.log
yarn-error.log
dist
out
*.tsbuildinfo

# logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# runtime data
pids
*.pid
*.seed
*.pid.lock

# coverage directories
coverage
lib-cov

# docker files
*.tar
dockerfile.*.bak

# general
tmp/
!**/.gitkeep
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# ides
.vscode
.idea
*.swp
*.swo

# opa
bundle.tar.gz

82 changes: 82 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Contributing

We welcome contributions to the project. This document provides information and
guidelines for contributing.

## Development Environment

This repository includes a configuration for a development container using the
[VS Code Remote - Containers extension](https://code.visualstudio.com/docs/remote/containers).
This setup allows you to develop within a Docker container that already has all
the necessary tools and dependencies installed.

The development container is based on Ubuntu 22.04 (Jammy) and includes the
following tools:

- AWS CLI
- Terraform

### Prerequisites

- [Docker](https://www.docker.com/products/docker-desktop) installed on your
local machine.
- [Visual Studio Code](https://code.visualstudio.com/) installed on your
local machine.
- [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
for Visual Studio Code.

### Usage

1. Clone and open this repository:

```bash
git clone https://github.com/sgtoj/terraform-aws-vpc-network.git
code terraform-aws-vpc-network
```

2. When prompted to "Reopen in Container", click "Reopen in Container". This
will start building the Docker image for the development container. If you're
not prompted, you can open the Command Palette (F1 or Ctrl+Shift+P), and run
the "Remote-Containers: Reopen Folder in Container" command.
3. After the development container is built and started, you can use the
Terminal in Visual Studio Code to interact with the container. All commands
you run in the Terminal will be executed inside the container.
### Troubleshooting
If you encounter any issues while using the development container, you can try
rebuilding the container. To do this, open the Command Palette and run the
"Remote-Containers: Rebuild Container" command.
## Contribution Guidelines
We appreciate your interest in contributing to the project. Here are some
guidelines to help ensure your contributions are accepted.
### Issues
- Use the GitHub issue tracker to report bugs or propose new features.
- Before submitting a new issue, please search to make sure it has not already
been reported. If it has, add a comment to the existing issue instead of
creating a new one.
- When reporting a bug, include as much detail as you can. Include the version
of the module you're using, what you expected to happen, what actually
happened, and steps to reproduce the bug.

### Pull Requests

- Submit your changes as a pull request.
- All pull requests should be associated with an issue. If your change isn't
associated with an existing issue, please create one before submitting a pull
request.
- In your pull request, include a summary of the changes, the issue number it
resolves, and any additional information that might be helpful for
understanding your changes.
- Make sure your changes do not break any existing functionality. If your
changes require updates to existing tests or the addition of new ones, include
those in your pull request.
- Follow the existing code style. We use a linter to maintain code quality, so
make sure your changes pass the linter checks.
Thank you for your contributions!
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 CruxStack LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PROJ_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

# allows args to pass to run-cmd example: make run-cmd echo "hello world"
ifeq (run-cmd,$(firstword $(MAKECMDGOALS)))
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(RUN_ARGS):;@:)
endif

all: deps build
@exit 0

deps:
@exit 0

build:
@exit 0

clean:
@find . -type d -name "dist" -exec rm -rf {} +
@find . -type d -name ".terraform" -exec rm -rf {} +
@find . -type d -name ".terraform.d" -exec rm -rf {} +
@find . -type d -name ".tfstate" -exec rm -rf {} +
@find . -type d -name ".tfstate.backup" -exec rm -rf {} +
@touch .devcontainer/.terraform.d/.gitkeep || true
Loading

0 comments on commit 18bb6b5

Please sign in to comment.