Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jbonnier committed Nov 3, 2023
0 parents commit 8d19cba
Show file tree
Hide file tree
Showing 17 changed files with 780 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .docs/header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
![nventive](https://nventive-public-assets.s3.amazonaws.com/nventive_logo_github.svg?v=2)

# terraform-aws-network

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](LICENSE) [![Latest Release](https://img.shields.io/github/release/nventive/terraform-aws-network.svg?style=flat-square)](https://github.com/nventive/terraform-aws-network/releases/latest)

Terraform module to create a VPC with public and private subnets.

---

## Examples

**IMPORTANT:** We do not pin modules to versions in our examples because of the difficulty of keeping the versions in
the documentation in sync with the latest released versions. We highly recommend that in your code you pin the version
to the exact version you are using so that your infrastructure remains stable, and update versions in a systematic way
so that they do not catch you by surprise.

```hcl
module "network" {
source = "nventive/network/aws"
# We recommend pinning every module to a specific version
# version = "x.x.x"
namespace = "eg"
stage = "test"
name = "app"
vpc_cidr_block = "10.0.0.0/16"
subnets_ipv4_cidr_block = ["10.0.0.0/16"]
subnets_availability_zones = ["us-east-1a", "us-east-1b"]
subnets_nat_gateway_enabled = true
s3_endpoint_enabled = true
}
```
53 changes: 53 additions & 0 deletions .docs/terraform-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
formatter: "markdown table"

header-from: .docs/header.md
footer-from: .docs/footer.md

recursive:
enabled: false
path: modules

sections:
hide: []
show: []

content: |-
{{ .Header }}
{{ .Requirements }}
{{ .Providers }}
{{ .Modules }}
{{ .Resources }}
{{ .Inputs }}
{{ .Outputs }}
{{ .Footer }}
output:
file: "README.md"
mode: replace
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
output-values:
enabled: false
from: ""

sort:
enabled: true
by: name

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
read-comments: true
required: true
sensitive: true
type: true
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4

[Makefile]
indent_style = tab
23 changes: 23 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Define text file attributes.
# - Treat them as text.
# - Ensure no CRLF line-endings, neither on checkout nor on checkin.
# - Detect whitespace errors.
# - Exposed by default in `git diff --color` on the CLI.
# - Validate with `git diff --check`.
# - Deny applying with `git apply --whitespace=error-all`.
# - Fix automatically with `git apply --whitespace=fix`.
*.md text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.tf text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yaml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
Makefile text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
.githooks/* text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2

# Define binary file attributes.
# - Do not treat them as text.
# - Include binary diff in patches instead of "binary files differ."
*.gif -text diff
*.jpeg -text diff
*.jpg -text diff
*.png -text diff
*.svgz -text diff
15 changes: 15 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# This hook will block a commit if Terraform isn't formatted properly or if README isn't up to date.
#

[[ -f "$(which terraform)" ]] || (echo 1>&2 'Git Hooks (pre-commit): Terraform not in $PATH, can''t reformat.' && exit 1)
terraform fmt -check 2>/dev/null || (echo 1>&2 'Git Hooks (pre-commit): Please run `terraform fmt` before committing.' && exit 1)

[[ -f "$(which terraform-docs)" ]] || (echo 1>&2 'Git Hooks (pre-commit): Terraform-docs not in $PATH, can''t update README file.' && exit 1)
curl -sLo .docs/footer.md https://gist.githubusercontent.com/nventive-devops/7892a2ac9a2cc2ea219dd81796b6ce8b/raw/readme-footer.md
terraform-docs markdown --config .docs/terraform-docs.yaml --output-check . 1>/dev/null 2>/dev/null || (
echo 1>&2 'Git Hooks (pre-commit): Terraform-docs README file is out of date.'
echo 1>&2 'Please run `make docs` before committing '
exit 1
)
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Expected Behavior


## Actual Behavior


## Steps to Reproduce the Problem

1.
2.
3.

## Specifications

- OS [e.g. Linux, OSX, WSL, etc]:
- Version [e.g. 11.5]:
- Module version:
- Terraform version:
40 changes: 40 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
GitHub Issue: #
<!-- Link to relevant GitHub issue if applicable.
All PRs should be associated with an issue -->

## Proposed Changes
<!-- Please check one or more that apply to this PR. -->

- [ ] Bug fix
- [ ] Feature
- [ ] Code style update (formatting)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build or CI related changes
- [ ] Documentation content changes
- [ ] Other, please describe:


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying,
or link to a relevant issue. -->


## What is the new behavior?
<!-- Please describe the new behavior after your modifications. -->


## Checklist

Please check that your PR fulfills the following requirements:

- [ ] Documentation has been added/updated.
- [ ] Automated tests for the changes have been added/updated.
- [ ] Commits have been squashed (if applicable).
- [ ] Updated [BREAKING_CHANGES.md](../BREAKING_CHANGES.md) (if you introduced a breaking change).

<!-- If this PR contains a breaking change, please describe the impact
and migration path for existing applications below. -->

## Other information
<!-- Please provide any additional information if necessary -->

21 changes: 21 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Conventional Commits

on:
pull_request:
types:
- opened
- synchronize

#env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
validate-commits:
runs-on: ubuntu-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Commitsar check
uses: docker://aevea/commitsar
35 changes: 35 additions & 0 deletions .github/workflows/terraform-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Terraform actions

on:
pull_request:
types:
- opened
- synchronize

jobs:
terraform-format-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1

- name: Check Terraform Code Formatting
run: terraform fmt -check

- name: Download footer.md
run: curl -sLo .docs/footer.md https://gist.githubusercontent.com/nventive-devops/7892a2ac9a2cc2ea219dd81796b6ce8b/raw/readme-footer.md

- name: Render terraform docs and push changes back to PR
uses: terraform-docs/gh-actions@main
with:
working-dir: .
git-commit-message: "docs: Update README.md (automated action)"
config-file: .docs/terraform-docs.yaml
output-file: README.md
output-method: replace
git-push: "true"
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# IDE
.idea
.vscode

# Terraform specific
.terraform.lock.hcl
.terraform/

# Temporary files
.docs/footer.md
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SHELL:=/bin/sh
.SILENT:

.PHONY: docs hooks
docs:
curl -sLo .docs/footer.md https://gist.githubusercontent.com/nventive-devops/7892a2ac9a2cc2ea219dd81796b6ce8b/raw/readme-footer.md
terraform-docs markdown --config .docs/terraform-docs.yaml .

hooks:
cp .githooks/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
Loading

0 comments on commit 8d19cba

Please sign in to comment.