-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* introduce tf best practices * add subnets for tf-plan workflow * add checkov skip statement
- Loading branch information
1 parent
5afe685
commit 4512b54
Showing
16 changed files
with
202 additions
and
52 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
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 was deleted.
Oops, something went wrong.
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,29 @@ | ||
name: tf-plan | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
plan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.TF_READ_ONLY_GITHUB_OIDC_ROLE_ARN }} | ||
aws-region: eu-west-1 | ||
- name: Set up Terraform | ||
uses: hashicorp/setup-terraform@v3 | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
- name: Terraform Plan | ||
id: plan | ||
run: terraform plan -var 'cluster_name=test' -var 'subnet_ids=["${{ secrets.PVT_SUBNET_ID_1 }}", "${{ secrets.PVT_SUBNET_ID_2 }}"]' |
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,35 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-json | ||
- id: check-symlinks | ||
- id: detect-private-key | ||
- id: no-commit-to-branch | ||
- repo: https://github.com/gitleaks/gitleaks | ||
rev: v8.18.42 | ||
hooks: | ||
- id: gitleaks | ||
- repo: https://github.com/antonbabenko/pre-commit-terraform | ||
rev: v1.92.0 | ||
hooks: | ||
- id: terraform_fmt | ||
- id: terraform_validate | ||
exclude: examples/ | ||
- id: terraform_tflint | ||
exclude: examples/ | ||
args: | ||
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl --fix | ||
- repo: https://github.com/bridgecrewio/checkov.git | ||
rev: "3.2.183" | ||
hooks: | ||
- id: checkov | ||
args: ["--quiet", "--compact", "--framework", "terraform", "--download-external-modules", "false", "--skip-path", "examples"] | ||
- repo: https://github.com/terraform-docs/terraform-docs | ||
rev: v0.18.0 | ||
hooks: | ||
- id: terraform-docs-go | ||
args: ["."] |
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 @@ | ||
formatter: "markdown table" # this is required | ||
|
||
header-from: .tf-header.md | ||
footer-from: .tf-footer.md | ||
|
||
recursive: | ||
enabled: false | ||
path: modules | ||
|
||
sections: | ||
hide: | ||
- resources | ||
- data-sources | ||
- modules | ||
- providers | ||
|
||
content: |- | ||
{{ .Header }} | ||
# Usage Instructions | ||
## Example | ||
```hcl | ||
{{ include "examples/default.tf" }} | ||
``` | ||
{{ .Requirements }} | ||
{{ .Inputs }} | ||
{{ .Outputs }} | ||
{{ .Footer }} | ||
output: | ||
file: README.md | ||
mode: inject | ||
template: |- | ||
<!-- BEGIN_TF_DOCS --> | ||
{{ .Content }} | ||
<!-- END_TF_DOCS --> | ||
output-values: | ||
enabled: false | ||
from: "" | ||
|
||
sort: | ||
enabled: true | ||
by: name | ||
|
||
settings: | ||
anchor: false | ||
color: true | ||
default: true | ||
description: false | ||
escape: false | ||
hide-empty: false | ||
html: false | ||
indent: 2 | ||
lockfile: false # because .terraform.lock.hcl is not checked in the repository | ||
read-comments: true | ||
required: true | ||
sensitive: false | ||
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,5 @@ | ||
## Autoscaling nodes | ||
|
||
For autoscaling nodes you can setup either of two: | ||
- [Cluster Autoscaler](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/aws/README.md) - [Helm Chart](https://github.com/kubernetes/autoscaler/tree/master/charts/cluster-autoscaler) | ||
- [Karpenter](https://karpenter.sh/) - [Helm Chart](https://github.com/aws/karpenter-provider-aws/tree/main/charts/karpenter) |
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,9 @@ | ||
# Title | ||
|
||
![License](https://img.shields.io/github/license/terrablocks/aws-eks-managed-node-group?style=for-the-badge) ![Plan](https://img.shields.io/github/actions/workflow/status/terrablocks/aws-eks-managed-node-group/tf-plan.yml?branch=main&label=Plan&style=for-the-badge) ![Checkov](https://img.shields.io/github/actions/workflow/status/terrablocks/aws-eks-managed-node-group/checkov.yml?branch=main&label=Checkov&style=for-the-badge) ![Commit](https://img.shields.io/github/last-commit/terrablocks/aws-eks-managed-node-group?style=for-the-badge) ![Release](https://img.shields.io/github/v/release/terrablocks/aws-eks-managed-node-group?style=for-the-badge) | ||
|
||
This terraform module will deploy the following services: | ||
- EKS Node Group | ||
- Auto Scaling Group | ||
- IAM Role | ||
- IAM Role Policy |
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 @@ | ||
plugin "aws" { | ||
enabled = true | ||
version = "0.30.0" | ||
source = "github.com/terraform-linters/tflint-ruleset-aws" | ||
} | ||
|
||
plugin "terraform" { | ||
enabled = true | ||
preset = "all" | ||
} |
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,6 @@ | ||
module "eks_managed_node_group" { | ||
source = "github.com/terrablocks/aws-eks-managed-node-group.git?ref=" # Always use `ref` to point module to a specific version or hash | ||
|
||
cluster_name = "eks-cluster" | ||
subnet_ids = ["subnet-xxxx", "subnet-yyyy"] | ||
} |
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
File renamed without changes.
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
terraform { | ||
required_version = ">= 0.13" | ||
required_version = ">= 1.8.0" | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 3.44.0" | ||
version = ">= 5.0.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