Skip to content

Commit d4cd33e

Browse files
authored
Merge pull request #7 from lablabs/multi-instance
Improvements
2 parents da4cde5 + cb1a77f commit d4cd33e

19 files changed

+444
-366
lines changed

.github/workflows/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ jobs:
7171
run: |
7272
pip install detect-secrets
7373
74+
- shell: bash
75+
name: "INSTALL: checkov"
76+
run: |
77+
pip install checkov
78+
7479
- shell: bash
7580
name: "INSTALL: tflint"
7681
if: steps.cache-tflint.outputs.cache-hit != 'true'

.pre-commit-config.yaml

+5-10
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: v3.4.0
3+
rev: v4.0.1
44
hooks:
55
- id: trailing-whitespace
66
- id: check-merge-conflict
@@ -9,18 +9,13 @@ repos:
99
- id: detect-private-key
1010
- id: end-of-file-fixer
1111

12-
- repo: https://github.com/gruntwork-io/pre-commit
13-
rev: v0.1.12
14-
hooks:
15-
- id: tflint
16-
- id: terraform-validate
17-
1812
- repo: git://github.com/antonbabenko/pre-commit-terraform
19-
rev: v1.47.0
13+
rev: v1.60.0
2014
hooks:
2115
- id: terraform_fmt
2216
- id: terraform_tflint
23-
# - id: terraform_tfsec
17+
- id: terraform_validate
18+
- id: checkov
2419
- id: terraform_docs
2520
args:
2621
- '--args=--hide providers --sort-by required'
@@ -31,7 +26,7 @@ repos:
3126
- id: terraform-vars
3227

3328
- repo: https://github.com/Yelp/detect-secrets
34-
rev: v0.14.3
29+
rev: v1.1.0
3530
hooks:
3631
- id: detect-secrets
3732
args: ['--baseline', '.secrets.baseline']

.secrets.baseline

+54-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
{
2-
"custom_plugin_paths": [],
3-
"exclude": {
4-
"files": null,
5-
"lines": null
6-
},
7-
"generated_at": "2020-09-21T20:48:01Z",
2+
"version": "1.1.0",
83
"plugins_used": [
4+
{
5+
"name": "ArtifactoryDetector"
6+
},
97
{
108
"name": "AWSKeyDetector"
119
},
1210
{
13-
"name": "ArtifactoryDetector"
11+
"name": "AzureStorageKeyDetector"
1412
},
1513
{
16-
"base64_limit": 4.5,
17-
"name": "Base64HighEntropyString"
14+
"name": "Base64HighEntropyString",
15+
"limit": 4.5
1816
},
1917
{
2018
"name": "BasicAuthDetector"
@@ -23,8 +21,8 @@
2321
"name": "CloudantDetector"
2422
},
2523
{
26-
"hex_limit": 3,
27-
"name": "HexHighEntropyString"
24+
"name": "HexHighEntropyString",
25+
"limit": 3.0
2826
},
2927
{
3028
"name": "IbmCloudIamDetector"
@@ -36,12 +34,15 @@
3634
"name": "JwtTokenDetector"
3735
},
3836
{
39-
"keyword_exclude": null,
40-
"name": "KeywordDetector"
37+
"name": "KeywordDetector",
38+
"keyword_exclude": ""
4139
},
4240
{
4341
"name": "MailchimpDetector"
4442
},
43+
{
44+
"name": "NpmDetector"
45+
},
4546
{
4647
"name": "PrivateKeyDetector"
4748
},
@@ -51,17 +52,52 @@
5152
{
5253
"name": "SoftlayerDetector"
5354
},
55+
{
56+
"name": "SquareOAuthDetector"
57+
},
5458
{
5559
"name": "StripeDetector"
5660
},
5761
{
5862
"name": "TwilioKeyDetector"
5963
}
6064
],
65+
"filters_used": [
66+
{
67+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
68+
},
69+
{
70+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
71+
"min_level": 2
72+
},
73+
{
74+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
75+
},
76+
{
77+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
78+
},
79+
{
80+
"path": "detect_secrets.filters.heuristic.is_lock_file"
81+
},
82+
{
83+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
84+
},
85+
{
86+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
87+
},
88+
{
89+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
90+
},
91+
{
92+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
93+
},
94+
{
95+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
96+
},
97+
{
98+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
99+
}
100+
],
61101
"results": {},
62-
"version": "0.14.3",
63-
"word_list": {
64-
"file": null,
65-
"hash": null
66-
}
102+
"generated_at": "2021-12-09T12:48:22Z"
67103
}

README.md

+25-25
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@ A terraform module to deploy an Cert Manager on Amazon EKS cluster.
1515

1616
## Related Projects
1717

18-
Check out these related projects.
19-
20-
- [terraform-aws-eks-calico](https://github.com/lablabs/terraform-aws-eks-calico)
21-
- [terraform-aws-eks-cluster-autoscaler](https://github.com/lablabs/terraform-aws-eks-cluster-autoscaler)
22-
- [terraform-aws-eks-alb-ingress](https://github.com/lablabs/terraform-aws-eks-alb-ingress)
23-
- [terraform-aws-eks-metrics-server](https://github.com/lablabs/terraform-aws-eks-metrics-server)
24-
- [terraform-aws-eks-prometheus-node-exporter](https://github.com/lablabs/terraform-aws-eks-prometheus-node-exporter)
25-
- [terraform-aws-eks-kube-state-metrics](https://github.com/lablabs/terraform-aws-eks-kube-state-metrics)
26-
- [terraform-aws-eks-node-problem-detector](https://github.com/lablabs/terraform-aws-eks-node-problem-detector)
27-
18+
Check out other [terraform kubernetes addons](https://github.com/lablabs?q=terraform-eks).
2819

2920
## Examples
3021

@@ -41,11 +32,12 @@ To overcome this issue, the module deploys the ArgoCD application object using t
4132

4233
| Name | Version |
4334
|------|---------|
44-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
35+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14 |
4536
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
46-
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 1.0 |
37+
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 1.0.0 |
38+
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.6 |
4739
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.6 |
48-
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.12.0 |
40+
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.14.0 |
4941

5042
## Modules
5143

@@ -55,18 +47,17 @@ No modules.
5547

5648
| Name | Type |
5749
|------|------|
58-
| [aws_iam_policy.cert_manager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
59-
| [aws_iam_role.cert_manager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
60-
| [aws_iam_role_policy_attachment.cert_manager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
50+
| [aws_iam_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
51+
| [aws_iam_role.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
52+
| [aws_iam_role_policy_attachment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
53+
| [aws_iam_role_policy_attachment.this_additional](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
6154
| [helm_release.argocd_application](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
62-
| [helm_release.cert_manager](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
6355
| [helm_release.default_cluster_issuer](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
64-
| [kubernetes_manifest.self](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest) | resource |
56+
| [helm_release.this](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
57+
| [kubernetes_manifest.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest) | resource |
6558
| [time_sleep.default_cluster_issuer](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
66-
| [aws_iam_policy_document.cert_manager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
67-
| [aws_iam_policy_document.cert_manager_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
68-
| [aws_iam_policy_document.cert_manager_irsa](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
69-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
59+
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
60+
| [aws_iam_policy_document.this_irsa](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
7061
| [utils_deep_merge_yaml.argo_application_values](https://registry.terraform.io/providers/cloudposse/utils/latest/docs/data-sources/deep_merge_yaml) | data source |
7162
| [utils_deep_merge_yaml.default_cluster_issuer_values](https://registry.terraform.io/providers/cloudposse/utils/latest/docs/data-sources/deep_merge_yaml) | data source |
7263
| [utils_deep_merge_yaml.values](https://registry.terraform.io/providers/cloudposse/utils/latest/docs/data-sources/deep_merge_yaml) | data source |
@@ -77,7 +68,6 @@ No modules.
7768
|------|-------------|------|---------|:--------:|
7869
| <a name="input_cluster_identity_oidc_issuer"></a> [cluster\_identity\_oidc\_issuer](#input\_cluster\_identity\_oidc\_issuer) | The OIDC Identity issuer for the cluster | `string` | n/a | yes |
7970
| <a name="input_cluster_identity_oidc_issuer_arn"></a> [cluster\_identity\_oidc\_issuer\_arn](#input\_cluster\_identity\_oidc\_issuer\_arn) | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account | `string` | n/a | yes |
80-
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | The name of the cluster | `string` | n/a | yes |
8171
| <a name="input_argo_application_enabled"></a> [argo\_application\_enabled](#input\_argo\_application\_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 |
8272
| <a name="input_argo_application_use_helm"></a> [argo\_application\_use\_helm](#input\_argo\_application\_use\_helm) | 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 |
8373
| <a name="input_argo_application_values"></a> [argo\_application\_values](#input\_argo\_application\_values) | Value overrides to use when deploying argo application object with helm | `string` | `""` | no |
@@ -95,19 +85,29 @@ No modules.
9585
| <a name="input_helm_create_namespace"></a> [helm\_create\_namespace](#input\_helm\_create\_namespace) | Whether to create k8s namespace with name defined by `k8s_namespace` | `bool` | `true` | no |
9686
| <a name="input_helm_release_name"></a> [helm\_release\_name](#input\_helm\_release\_name) | Helm release name | `string` | `"cert-manager"` | no |
9787
| <a name="input_helm_repo_url"></a> [helm\_repo\_url](#input\_helm\_repo\_url) | Helm repository | `string` | `"https://charts.jetstack.io"` | no |
98-
| <a name="input_k8s_assume_role_arn"></a> [k8s\_assume\_role\_arn](#input\_k8s\_assume\_role\_arn) | Whether to create and use default role or assume existing role. Useful for hosted zones in another AWS account. Default (empty string) use default role. | `string` | `""` | no |
88+
| <a name="input_k8s_assume_role_arns"></a> [k8s\_assume\_role\_arns](#input\_k8s\_assume\_role\_arns) | Allow IRSA to assume specified role arns. Assume role must be enabled. | `list(string)` | `[]` | no |
89+
| <a name="input_k8s_assume_role_enabled"></a> [k8s\_assume\_role\_enabled](#input\_k8s\_assume\_role\_enabled) | Whether IRSA is allowed to assume role defined by k8s\_assume\_role\_arn. Useful for hosted zones in another AWS account. | `bool` | `false` | no |
90+
| <a name="input_k8s_irsa_additional_policies"></a> [k8s\_irsa\_additional\_policies](#input\_k8s\_irsa\_additional\_policies) | Map of the additional policies to be attached to default role. Where key is arbiraty id and value is policy arn. | `map(string)` | `{}` | no |
91+
| <a name="input_k8s_irsa_policy_enabled"></a> [k8s\_irsa\_policy\_enabled](#input\_k8s\_irsa\_policy\_enabled) | Whether to create opinionated policy to allow operations on specified zones in `policy_allowed_zone_ids`. | `bool` | `true` | no |
9992
| <a name="input_k8s_irsa_role_create"></a> [k8s\_irsa\_role\_create](#input\_k8s\_irsa\_role\_create) | Whether to create IRSA role and annotate service account | `bool` | `true` | no |
93+
| <a name="input_k8s_irsa_role_name_prefix"></a> [k8s\_irsa\_role\_name\_prefix](#input\_k8s\_irsa\_role\_name\_prefix) | The IRSA role name prefix for prometheus | `string` | `"cert-manager-irsa"` | no |
10094
| <a name="input_k8s_namespace"></a> [k8s\_namespace](#input\_k8s\_namespace) | The K8s namespace in which the external-dns will be installed | `string` | `"kube-system"` | no |
10195
| <a name="input_k8s_rbac_create"></a> [k8s\_rbac\_create](#input\_k8s\_rbac\_create) | Whether to create and use RBAC resources | `bool` | `true` | no |
10296
| <a name="input_k8s_service_account_create"></a> [k8s\_service\_account\_create](#input\_k8s\_service\_account\_create) | Whether to create Service Account | `bool` | `true` | no |
10397
| <a name="input_k8s_service_account_name"></a> [k8s\_service\_account\_name](#input\_k8s\_service\_account\_name) | The k8s cert-manager service account name | `string` | `"cert-manager"` | no |
10498
| <a name="input_policy_allowed_zone_ids"></a> [policy\_allowed\_zone\_ids](#input\_policy\_allowed\_zone\_ids) | List of the Route53 zone ids for service account IAM role access | `list(string)` | <pre>[<br> "*"<br>]</pre> | no |
10599
| <a name="input_settings"></a> [settings](#input\_settings) | Additional settings which will be passed to the Helm chart values, see https://artifacthub.io/packages/helm/cert-manager/cert-manager | `map(any)` | `{}` | no |
100+
| <a name="input_tags"></a> [tags](#input\_tags) | AWS resources tags | `map(string)` | `{}` | no |
106101
| <a name="input_values"></a> [values](#input\_values) | Additional values for cert manager helm chart. Values will be merged, in order, as Helm does with multiple -f options | `string` | `""` | no |
107102

108103
## Outputs
109104

110-
No outputs.
105+
| Name | Description |
106+
|------|-------------|
107+
| <a name="output_helm_release_application_metadata"></a> [helm\_release\_application\_metadata](#output\_helm\_release\_application\_metadata) | Argo application helm release attributes |
108+
| <a name="output_helm_release_metadata"></a> [helm\_release\_metadata](#output\_helm\_release\_metadata) | Helm release attributes |
109+
| <a name="output_iam_role_attributes"></a> [iam\_role\_attributes](#output\_iam\_role\_attributes) | Prometheus IAM role atributes |
110+
| <a name="output_kubernetes_application_attributes"></a> [kubernetes\_application\_attributes](#output\_kubernetes\_application\_attributes) | Argo kubernetes manifest attributes |
111111
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
112112

113113
## Contributing and reporting issues

argo.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ locals {
88
"helm" : {
99
"releaseName" : var.helm_release_name
1010
"parameters" : [for k, v in var.settings : tomap({ "forceString" : true, "name" : k, "value" : v })]
11-
"values" : data.utils_deep_merge_yaml.values[0].output
11+
"values" : var.enabled ? data.utils_deep_merge_yaml.values[0].output : ""
1212
}
1313
}
1414
"destination" : {
@@ -41,7 +41,7 @@ resource "helm_release" "argocd_application" {
4141
}
4242

4343

44-
resource "kubernetes_manifest" "self" {
44+
resource "kubernetes_manifest" "this" {
4545
count = var.enabled && var.argo_application_enabled && !var.argo_application_use_helm ? 1 : 0
4646
manifest = {
4747
"apiVersion" = "argoproj.io/v1alpha1"

examples/basic/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ No requirements.
1111

1212
| Name | Source | Version |
1313
|------|--------|---------|
14-
| <a name="module_cert-manager"></a> [cert-manager](#module\_cert-manager) | ../../ | n/a |
15-
| <a name="module_eks_cluster"></a> [eks\_cluster](#module\_eks\_cluster) | cloudposse/eks-cluster/aws | 0.43.2 |
16-
| <a name="module_eks_node_group"></a> [eks\_node\_group](#module\_eks\_node\_group) | cloudposse/eks-node-group/aws | 0.25.0 |
17-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 3.6.0 |
14+
| <a name="module_disabled"></a> [disabled](#module\_disabled) | ../../ | n/a |
15+
| <a name="module_eks_cluster"></a> [eks\_cluster](#module\_eks\_cluster) | cloudposse/eks-cluster/aws | 0.44.0 |
16+
| <a name="module_example"></a> [example](#module\_example) | ../../ | n/a |
17+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 3.11.0 |
1818

1919
## Resources
2020

examples/basic/base.tf

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module "vpc" {
2+
source = "terraform-aws-modules/vpc/aws"
3+
version = "3.11.0"
4+
5+
name = "vpc"
6+
cidr = "10.0.0.0/16"
7+
azs = ["eu-central-1a", "eu-central-1b"]
8+
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
9+
enable_nat_gateway = true
10+
}
11+
12+
module "eks_cluster" {
13+
source = "cloudposse/eks-cluster/aws"
14+
version = "0.44.0"
15+
16+
region = "eu-central-1"
17+
subnet_ids = module.vpc.public_subnets
18+
vpc_id = module.vpc.vpc_id
19+
name = "k8s"
20+
}

0 commit comments

Comments
 (0)