Skip to content

Commit faa9d89

Browse files
committed
feat: align module to the addon-template
1 parent dc0b0f7 commit faa9d89

16 files changed

+168
-68
lines changed

.github/RELEASE_DRAFTER.yml

+16-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@ categories:
77
- 'enhancement'
88
- title: 'Bug Fixes'
99
labels:
10-
- 'fix'
11-
- 'bugfix'
1210
- 'bug'
1311
- title: 'Documentation'
1412
label: 'documentation'
13+
- title: 'CI'
14+
label: 'ci'
15+
version-resolver:
16+
major:
17+
labels:
18+
- 'major'
19+
minor:
20+
labels:
21+
- 'feature'
22+
- 'enhancement'
23+
patch:
24+
labels:
25+
- 'ci'
26+
- 'bug'
27+
- 'documentation'
28+
default: patch
1529
change-template: '- $TITLE, by @$AUTHOR (#$NUMBER)'
1630
template: |
1731
# What's changed

.github/workflows/pre-commit.yml

+37-28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: pre-commit
22

3+
permissions:
4+
contents: read
5+
36
on:
47
workflow_dispatch:
58
pull_request:
@@ -8,36 +11,42 @@ on:
811
- master
912

1013
env:
14+
PYTHON_VERSION: "3.10"
1115
TERRAFORM_DOCS_VERSION: "v0.16.0"
12-
TFLINT_VERSION: "v0.36.2"
16+
TFLINT_VERSION: "v0.40.1"
1317

1418
jobs:
1519
pre-commit:
16-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-22.04
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1723
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-python@v2
20-
21-
- name: Install additional pre-commit hooks
22-
shell: bash
23-
run: |
24-
echo "########### Install Checkov ####################"
25-
pip install checkov
26-
27-
echo "########### Install Terraform-docs #############"
28-
wget https://github.com/terraform-docs/terraform-docs/releases/download/${{ env.TERRAFORM_DOCS_VERSION }}/terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz
29-
tar xvzf terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz
30-
mkdir -p ~/terraform-docs/bin/
31-
install terraform-docs ~/terraform-docs/bin/
32-
echo '~/terraform-docs/bin/' >> $GITHUB_PATH
33-
34-
echo "########### Install Terraform-linters ##########"
35-
wget https://github.com/terraform-linters/tflint/releases/download/${{ env.TFLINT_VERSION }}/tflint_linux_amd64.zip
36-
unzip tflint_linux_amd64.zip
37-
mkdir -p ~/tflint/bin/
38-
echo '~/tflint/bin/' >> $GITHUB_PATH
39-
install tflint ~/tflint/bin/
40-
~/tflint/bin/tflint --init
41-
42-
- name: Run pre-commit
43-
uses: pre-commit/[email protected]
24+
- uses: actions/checkout@v3
25+
- uses: actions/setup-python@v4
26+
with:
27+
python-version: ${{ env.PYTHON_VERSION }}
28+
cache: pip
29+
30+
- name: Install Python dependencies
31+
run: pip install -r requirements.txt
32+
33+
- name: Install terraform-docs
34+
uses: jaxxstorm/[email protected]
35+
with:
36+
repo: terraform-docs/terraform-docs
37+
tag: ${{ env.TERRAFORM_DOCS_VERSION }}
38+
cache: enable
39+
40+
- name: TFLint cache
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.tflint.d/plugins
44+
key: ${{ runner.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
45+
46+
- name: Install TFLint
47+
uses: terraform-linters/setup-tflint@v2
48+
with:
49+
tflint_version: ${{ env.TFLINT_VERSION }}
50+
51+
- name: Run pre-commit
52+
uses: pre-commit/[email protected]

.github/workflows/release-drafter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515

1616
jobs:
1717
update_release_draft:
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04
1919
steps:
2020
- uses: release-drafter/release-drafter@v5
2121
with:

.github/workflows/validate.yaml

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Terraform validate
22

3+
permissions:
4+
contents: read
5+
36
on:
47
workflow_dispatch:
58
pull_request:
@@ -10,11 +13,11 @@ on:
1013
jobs:
1114
versionExtract:
1215
name: Extract min/max Terraform versions
13-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-22.04
1417

1518
steps:
1619
- name: Checkout
17-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
1821

1922
- name: Extract Terraform min/max versions
2023
id: minMax
@@ -26,7 +29,7 @@ jobs:
2629
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
2730

2831
terraform-validate:
29-
runs-on: ubuntu-20.04
32+
runs-on: ubuntu-22.04
3033
needs: versionExtract
3134
strategy:
3235
matrix:
@@ -35,17 +38,15 @@ jobs:
3538
- ${{ needs.versionExtract.outputs.maxVersion }}
3639

3740
steps:
38-
- uses: actions/checkout@v2
41+
- uses: actions/checkout@v3
3942
- uses: hashicorp/setup-terraform@v2
4043
with:
4144
terraform_version: ${{ matrix.tf_ver }}
4245

43-
- name: Validate module
44-
run: |
45-
terraform init
46-
terraform validate
47-
- name: Validate example
48-
run: |
49-
cd examples/basic
50-
terraform init
51-
terraform validate
46+
- name: Terraform Init
47+
id: init
48+
run: terraform init
49+
50+
- name: Terraform Validate
51+
id: validate
52+
run: terraform validate

.pre-commit-config.yaml

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.2.0
3+
rev: v4.3.0
44
hooks:
55
- id: trailing-whitespace
66
- id: check-merge-conflict
@@ -10,20 +10,15 @@ repos:
1010
- id: end-of-file-fixer
1111

1212
- repo: https://github.com/antonbabenko/pre-commit-terraform
13-
rev: v1.71.0
13+
rev: v1.75.0
1414
hooks:
1515
- id: terraform_fmt
1616
- id: terraform_tflint
1717
- id: terraform_validate
1818
- id: terraform_checkov
1919
- id: terraform_docs
2020
args:
21-
- '--args=--hide providers --sort-by required'
22-
23-
- repo: https://github.com/pecigonzalo/pre-commit-terraform-vars
24-
rev: v1.0.0
25-
hooks:
26-
- id: terraform-vars
21+
- '--args=--config=.terraform-docs.yml'
2722

2823
- repo: https://github.com/Yelp/detect-secrets
2924
rev: v1.3.0

.terraform-docs.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
formatter: markdown table
2+
3+
output:
4+
mode: inject
5+
template: |-
6+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
7+
{{ .Content }}
8+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9+
10+
sections:
11+
hide:
12+
- providers
13+
14+
sort:
15+
by: required

.tflint.hcl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugin "terraform" {
2+
enabled = true
3+
version = "0.1.1"
4+
source = "github.com/terraform-linters/tflint-ruleset-terraform"
5+
preset = "recommended"
6+
}
7+
plugin "aws" {
8+
enabled = true
9+
version = "0.17.0"
10+
source = "github.com/terraform-linters/tflint-ruleset-aws"
11+
}

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AWS EKS Cert Manager Terraform module
22

3-
[![Labyrinth Labs logo](ll-logo.png)](https://www.lablabs.io)
3+
[<img src="https://lablabs.io/static/ll-logo.png" width=350px>](https://lablabs.io/)
44

55
We help companies build, run, deploy and scale software and infrastructure by embracing the right technologies and principles. Check out our website at <https://lablabs.io/>
66

@@ -123,23 +123,23 @@ No modules.
123123
| <a name="input_argo_enabled"></a> [argo\_enabled](#input\_argo\_enabled) | If set to true, the module will be deployed as ArgoCD application, otherwise it will be deployed as a Helm release | `bool` | `false` | no |
124124
| <a name="input_argo_helm_enabled"></a> [argo\_helm\_enabled](#input\_argo\_helm\_enabled) | If set to true, the ArgoCD Application manifest will be deployed using Kubernetes provider as a Helm release. Otherwise it'll be deployed as a Kubernetes manifest. See Readme for more info | `bool` | `false` | no |
125125
| <a name="input_argo_helm_values"></a> [argo\_helm\_values](#input\_argo\_helm\_values) | Value overrides to use when deploying argo application object with helm | `string` | `""` | no |
126-
| <a name="input_argo_info"></a> [argo\_info](#input\_argo\_info) | ArgoCD info manifest parameter | `list` | <pre>[<br> {<br> "name": "terraform",<br> "value": "true"<br> }<br>]</pre> | no |
126+
| <a name="input_argo_info"></a> [argo\_info](#input\_argo\_info) | ArgoCD info manifest parameter | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | <pre>[<br> {<br> "name": "terraform",<br> "value": "true"<br> }<br>]</pre> | no |
127127
| <a name="input_argo_kubernetes_manifest_computed_fields"></a> [argo\_kubernetes\_manifest\_computed\_fields](#input\_argo\_kubernetes\_manifest\_computed\_fields) | List of paths of fields to be handled as "computed". The user-configured value for the field will be overridden by any different value returned by the API after apply. | `list(string)` | <pre>[<br> "metadata.labels",<br> "metadata.annotations"<br>]</pre> | no |
128128
| <a name="input_argo_kubernetes_manifest_field_manager_force_conflicts"></a> [argo\_kubernetes\_manifest\_field\_manager\_force\_conflicts](#input\_argo\_kubernetes\_manifest\_field\_manager\_force\_conflicts) | Forcibly override any field manager conflicts when applying the kubernetes manifest resource | `bool` | `false` | no |
129129
| <a name="input_argo_kubernetes_manifest_field_manager_name"></a> [argo\_kubernetes\_manifest\_field\_manager\_name](#input\_argo\_kubernetes\_manifest\_field\_manager\_name) | The name of the field manager to use when applying the kubernetes manifest resource. Defaults to Terraform | `string` | `"Terraform"` | no |
130130
| <a name="input_argo_kubernetes_manifest_wait_fields"></a> [argo\_kubernetes\_manifest\_wait\_fields](#input\_argo\_kubernetes\_manifest\_wait\_fields) | A map of fields and a corresponding regular expression with a pattern to wait for. The provider will wait until the field matches the regular expression. Use * for any value. | `map(string)` | `{}` | no |
131-
| <a name="input_argo_metadata"></a> [argo\_metadata](#input\_argo\_metadata) | ArgoCD Application metadata configuration. Override or create additional metadata parameters | `map` | <pre>{<br> "finalizers": [<br> "resources-finalizer.argocd.argoproj.io"<br> ]<br>}</pre> | no |
131+
| <a name="input_argo_metadata"></a> [argo\_metadata](#input\_argo\_metadata) | ArgoCD Application metadata configuration. Override or create additional metadata parameters | `any` | <pre>{<br> "finalizers": [<br> "resources-finalizer.argocd.argoproj.io"<br> ]<br>}</pre> | no |
132132
| <a name="input_argo_namespace"></a> [argo\_namespace](#input\_argo\_namespace) | Namespace to deploy ArgoCD application CRD to | `string` | `"argo"` | no |
133133
| <a name="input_argo_project"></a> [argo\_project](#input\_argo\_project) | ArgoCD Application project | `string` | `"default"` | no |
134-
| <a name="input_argo_spec"></a> [argo\_spec](#input\_argo\_spec) | ArgoCD Application spec configuration. Override or create additional spec parameters | `map` | `{}` | no |
135-
| <a name="input_argo_sync_policy"></a> [argo\_sync\_policy](#input\_argo\_sync\_policy) | ArgoCD syncPolicy manifest parameter | `map` | `{}` | no |
134+
| <a name="input_argo_spec"></a> [argo\_spec](#input\_argo\_spec) | ArgoCD Application spec configuration. Override or create additional spec parameters | `any` | `{}` | no |
135+
| <a name="input_argo_sync_policy"></a> [argo\_sync\_policy](#input\_argo\_sync\_policy) | ArgoCD syncPolicy manifest parameter | `any` | `{}` | no |
136136
| <a name="input_cluster_issuer_enabled"></a> [cluster\_issuer\_enabled](#input\_cluster\_issuer\_enabled) | Variable indicating whether default ClusterIssuer CRD is enabled | `bool` | `false` | no |
137137
| <a name="input_cluster_issuer_settings"></a> [cluster\_issuer\_settings](#input\_cluster\_issuer\_settings) | Additional settings which will be passed to the Helm chart cluster\_issuer values, see https://github.com/lablabs/terraform-aws-eks-cert-manager/blob/main/helm/defaultClusterIssuer/values.yaml | `map(any)` | `{}` | no |
138138
| <a name="input_cluster_issuers_values"></a> [cluster\_issuers\_values](#input\_cluster\_issuers\_values) | Additional values for cert manager cluster issuers helm chart. Values will be merged, in order, as Helm does with multiple -f options | `string` | `""` | no |
139139
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Variable indicating whether deployment is enabled | `bool` | `true` | no |
140140
| <a name="input_helm_atomic"></a> [helm\_atomic](#input\_helm\_atomic) | If set, installation process purges chart on fail. The wait flag will be set automatically if atomic is used | `bool` | `false` | no |
141141
| <a name="input_helm_chart_name"></a> [helm\_chart\_name](#input\_helm\_chart\_name) | Helm chart name to be installed | `string` | `"cert-manager"` | no |
142-
| <a name="input_helm_chart_version"></a> [helm\_chart\_version](#input\_helm\_chart\_version) | Version of the Helm chart | `string` | `"1.9.1"` | no |
142+
| <a name="input_helm_chart_version"></a> [helm\_chart\_version](#input\_helm\_chart\_version) | Version of the Helm chart | `string` | `"1.12.1"` | no |
143143
| <a name="input_helm_cleanup_on_fail"></a> [helm\_cleanup\_on\_fail](#input\_helm\_cleanup\_on\_fail) | Allow deletion of new resources created in this helm upgrade when upgrade fails | `bool` | `false` | no |
144144
| <a name="input_helm_create_namespace"></a> [helm\_create\_namespace](#input\_helm\_create\_namespace) | Whether to create k8s namespace with name defined by `namespace` | `bool` | `true` | no |
145145
| <a name="input_helm_dependency_update"></a> [helm\_dependency\_update](#input\_helm\_dependency\_update) | Runs helm dependency update before installing the chart | `bool` | `false` | no |

examples/basic/README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ The code in this example shows how to use the module with basic configuration an
55
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
66
## Requirements
77

8-
No requirements.
8+
| Name | Version |
9+
|------|---------|
10+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
11+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.19.0 |
12+
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.6.0 |
13+
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.11.0 |
914

1015
## Modules
1116

@@ -18,8 +23,9 @@ No requirements.
1823
| <a name="module_cert_manager_helm"></a> [cert\_manager\_helm](#module\_cert\_manager\_helm) | ../../ | n/a |
1924
| <a name="module_cert_manager_without_irsa_policy"></a> [cert\_manager\_without\_irsa\_policy](#module\_cert\_manager\_without\_irsa\_policy) | ../../ | n/a |
2025
| <a name="module_cert_manager_without_irsa_role"></a> [cert\_manager\_without\_irsa\_role](#module\_cert\_manager\_without\_irsa\_role) | ../../ | n/a |
21-
| <a name="module_eks_cluster"></a> [eks\_cluster](#module\_eks\_cluster) | cloudposse/eks-cluster/aws | 0.44.0 |
22-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 3.11.0 |
26+
| <a name="module_eks_cluster"></a> [eks\_cluster](#module\_eks\_cluster) | cloudposse/eks-cluster/aws | 2.3.0 |
27+
| <a name="module_eks_node_group"></a> [eks\_node\_group](#module\_eks\_node\_group) | cloudposse/eks-node-group/aws | 2.4.0 |
28+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 4.0.0 |
2329

2430
## Resources
2531

examples/basic/base.tf

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module "vpc" {
22
source = "terraform-aws-modules/vpc/aws"
3-
version = "3.11.0"
3+
version = "4.0.0"
44

5-
name = "vpc"
5+
name = "cluster-autoscaler-vpc"
66
cidr = "10.0.0.0/16"
77
azs = ["eu-central-1a", "eu-central-1b"]
88
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
@@ -11,10 +11,23 @@ module "vpc" {
1111

1212
module "eks_cluster" {
1313
source = "cloudposse/eks-cluster/aws"
14-
version = "0.44.0"
14+
version = "2.3.0"
1515

1616
region = "eu-central-1"
1717
subnet_ids = module.vpc.public_subnets
1818
vpc_id = module.vpc.vpc_id
19-
name = "k8s"
19+
name = "basic-example"
20+
}
21+
22+
module "eks_node_group" {
23+
source = "cloudposse/eks-node-group/aws"
24+
version = "2.4.0"
25+
26+
cluster_name = module.eks_cluster.eks_cluster_id
27+
instance_types = ["t3.medium"]
28+
subnet_ids = module.vpc.public_subnets
29+
min_size = 1
30+
desired_size = 1
31+
max_size = 2
32+
depends_on = [module.eks_cluster.kubernetes_config_map_id]
2033
}

examples/basic/main.tf

+9-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ locals {
3434
"email" : "[email protected]"
3535
"server" : "https://acme-v02.api.letsencrypt.org/directory"
3636
}
37-
37+
}
38+
}
39+
"http" : {
40+
"default-http" : {
41+
"ingressClassName" : "nginx"
42+
"acme" : {
43+
"email" : "[email protected]"
44+
"server" : "https://acme-v02.api.letsencrypt.org/directory"
45+
}
3846
}
3947
}
4048
})

examples/basic/providers.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ provider "helm" {
1414
kubernetes {
1515
host = data.aws_eks_cluster.this.endpoint
1616
token = data.aws_eks_cluster_auth.this.token
17-
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority.0.data)
17+
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
1818
}
1919
}
2020

2121
provider "kubernetes" {
2222
host = data.aws_eks_cluster.this.endpoint
2323
token = data.aws_eks_cluster_auth.this.token
24-
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority.0.data)
24+
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
2525
}

examples/basic/versions.tf

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 4.19.0"
8+
}
9+
kubernetes = {
10+
source = "hashicorp/kubernetes"
11+
version = ">= 2.11.0"
12+
}
13+
helm = {
14+
source = "hashicorp/helm"
15+
version = ">= 2.6.0"
16+
}
17+
}
18+
}

ll-logo.png

-11.8 KB
Binary file not shown.

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
checkov==2.2.158

0 commit comments

Comments
 (0)