-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jbonnier
committed
Sep 28, 2023
0 parents
commit 787cc77
Showing
17 changed files
with
1,018 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
![nventive](https://nventive-public-assets.s3.amazonaws.com/nventive_logo_github.svg?v=2) | ||
|
||
# terraform-aws-ecs-cluster | ||
|
||
[![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-ecs-cluster.svg?style=flat-square)](https://github.com/nventive/terraform-aws-ecs-cluster/releases/latest) | ||
|
||
Terraform module to create an ECS Cluster. | ||
|
||
--- | ||
|
||
## Providers | ||
|
||
This modules uses two instances of the AWS provider. One for Route 53 resources and one for the rest. The reason why is | ||
that Route 53 is often in a different account (ie. in the prod account when creating resources for dev). | ||
|
||
You must provide both providers, whether you use Route 53 or not. In any case, you can specify the same provider for | ||
both if need be. | ||
|
||
## 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 "ecs_cluster" { | ||
source = "nventive/ecs-cluster/aws" | ||
# We recommend pinning every module to a specific version | ||
# version = "x.x.x" | ||
namespace = "eg" | ||
stage = "test" | ||
name = "app" | ||
providers = { | ||
aws = aws | ||
aws.route53 = aws.route53 | ||
} | ||
subnet_ids = ["subnet-xxxxxxxxxxxxxxxx1", "subnet-xxxxxxxxxxxxxxxx2"] | ||
parent_zone_name = "example.com" | ||
alb_enabled = true | ||
alb_dns_aliases = ["test.example.com", "demo.example.com"] | ||
} | ||
``` | ||
|
||
Should you want to use the same AWS provider for both Route 53 and the default one. | ||
|
||
```hcl | ||
module "ecs_cluster" { | ||
source = "nventive/ecs-cluster/aws" | ||
# We recommend pinning every module to a specific version | ||
# version = "x.x.x" | ||
providers = { | ||
aws = aws | ||
aws.route53 = aws | ||
} | ||
# ... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
tab_width = 2 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
tab_width = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.