-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Namespace is not required anymore - ALB moved to it's own file - EFS moved into it's own file - ECR moved into it's own file - IAM instance profile name doesn't include namespace (only if it's part of `var.name`) - Cloudwatch ECS events name renamed (use `-` instead of `_`0 - Cluster name can't be inferred anymore (must be passed via parameter). Also is mandatory now. - ECR Repo name doesn't use namespace (only if it's included by the `var.name` - Docker image can be inferred from the ECR repo name (if managed) - EFS share creation separated from EFS share mount - Added ability to provide efs file system id explicitly (if it's not managed) - Bridgecrew tests removed (product discontinued) - Minor directory restructure - Variables ordering and updates - Minor reformatting & language updates - Precommit workflow added - Simple example added to README - Submodules README files added - Complete Examples updated - Added .editorconfig
- Loading branch information
1 parent
cdddeb0
commit 5db53f6
Showing
39 changed files
with
614 additions
and
243 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,30 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
# Uses editorconfig to maintain consistent coding styles | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{tf,tfvars}] | ||
indent_size = 2 | ||
indent_style = space | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
tab_width = 2 | ||
indent_style = tab | ||
|
||
[COMMIT_EDITMSG] | ||
max_line_length = 0 |
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,98 @@ | ||
name: Pre-Commit | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
TERRAFORM_DOCS_VERSION: v0.16.0 | ||
TFLINT_VERSION: v0.50.3 | ||
|
||
jobs: | ||
collect-inputs: | ||
name: Collect workflow inputs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
directories: ${{ steps.dirs.outputs.directories }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get root directories | ||
id: dirs | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
|
||
precommit-min-versions: | ||
name: Min TF pre-commit | ||
needs: collect-inputs | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
directory: ${{ fromJson(needs.collect-inputs.outputs.directories) }} | ||
steps: | ||
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449 | ||
- name: Delete huge unnecessary tools folder | ||
run: | | ||
rm -rf /opt/hostedtoolcache/CodeQL | ||
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk | ||
rm -rf /opt/hostedtoolcache/Ruby | ||
rm -rf /opt/hostedtoolcache/go | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Terraform min/max versions | ||
id: min-max | ||
uses: clowdhaus/[email protected] | ||
with: | ||
directory: ${{ matrix.directory }} | ||
|
||
- name: Pre-commit Terraform ${{ steps.min-max.outputs.min-version }} | ||
# Run only validate pre-commit check on min version supported | ||
if: ${{ matrix.directory != '.' }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
with: | ||
terraform-version: ${{ steps.min-max.outputs.min-version }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*' | ||
|
||
- name: Pre-commit Terraform ${{ steps.min-max.outputs.min-version }} | ||
# Run only validate pre-commit check on min version supported | ||
if: ${{ matrix.directory == '.' }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
with: | ||
terraform-version: ${{ steps.min-max.outputs.min-version }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)' | ||
|
||
precommit-max-versions: | ||
name: Max TF pre-commit | ||
runs-on: ubuntu-latest | ||
needs: collect-inputs | ||
steps: | ||
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449 | ||
- name: Delete huge unnecessary tools folder | ||
run: | | ||
rm -rf /opt/hostedtoolcache/CodeQL | ||
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk | ||
rm -rf /opt/hostedtoolcache/Ruby | ||
rm -rf /opt/hostedtoolcache/go | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
|
||
- name: Terraform min/max versions | ||
id: min-max | ||
uses: clowdhaus/[email protected] | ||
|
||
- name: Pre-commit Terraform ${{ steps.min-max.outputs.max-version }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
with: | ||
terraform-version: ${{ steps.min-max.outputs.max-version }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }} | ||
install-hcledit: 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
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,30 @@ | ||
module "alb" { | ||
count = var.app_type == "web" || var.app_type == "tcp-app" ? 1 : 0 | ||
|
||
source = "registry.terraform.io/terraform-aws-modules/alb/aws" | ||
version = "~> 7.0" | ||
|
||
name = var.public ? local.name : "${local.name}-private" | ||
load_balancer_type = var.app_type == "web" ? "application" : "network" | ||
internal = var.public ? false : true | ||
vpc_id = var.vpc_id | ||
security_groups = var.alb_security_groups | ||
subnets = var.public ? var.public_subnets : var.private_subnets | ||
idle_timeout = var.alb_idle_timeout | ||
|
||
|
||
|
||
http_tcp_listeners = local.alb_http_tcp_listeners | ||
https_listeners = var.https_enabled ? concat(local.alb_https_listeners) : [] | ||
|
||
target_groups = concat(var.app_type == "web" ? local.target_groups_web : local.target_groups_tcp) | ||
|
||
access_logs = var.alb_access_logs_enabled && var.alb_access_logs_s3bucket_name != "" ? { | ||
bucket = var.alb_access_logs_s3bucket_name | ||
} : {} | ||
|
||
tags = { | ||
env = var.env | ||
Env = var.env | ||
} | ||
} |
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
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,8 @@ | ||
module "ecr" { | ||
source = "registry.terraform.io/hazelops/ecr/aws" | ||
version = "~> 1.1" | ||
|
||
name = local.ecr_repo_name | ||
enabled = var.ecr_repo_create | ||
force_delete = var.ecr_force_delete | ||
} |
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 @@ | ||
module "efs" { | ||
source = "registry.terraform.io/cloudposse/efs/aws" | ||
version = "~> 0.31" | ||
|
||
enabled = var.efs_enabled && var.efs_share_create ? true : false | ||
stage = var.env | ||
name = var.name | ||
region = data.aws_region.current.name | ||
vpc_id = var.vpc_id | ||
security_groups = var.security_groups | ||
|
||
# This is a workaround for 2-zone legacy setups | ||
subnets = length(regexall("legacy", var.env)) > 0 ? [ | ||
var.private_subnets[0], | ||
var.private_subnets[1] | ||
] : var.private_subnets | ||
|
||
} |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.