From 431bddb8683f3d0867cbae47d7fc51946bdaa1b0 Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Mon, 19 Aug 2024 20:40:25 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(kubectl):=20updated=20kubectl?= =?UTF-8?q?=20version=20and=20resolve=20lints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - README.md | 21 +++++++-------------- cluster_autoscaler.tf.off | 2 -- efs-filesystem.tf.off | 4 ++-- eks_console_access.tf | 1 - examples/simple/providers.tf | 23 ++++++++++++++++++++++- examples/simple/variables.tf | 2 +- main.tf | 9 +++++---- outputs.tf | 4 ++-- requirements.tf | 6 +++--- variables.tf | 5 ++++- version.tf | 4 ++-- 12 files changed, 48 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 7c1cae9..403ffa9 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,3 @@ override.tf.json # Ignore CLI configuration files .terraformrc terraform.rc - diff --git a/README.md b/README.md index 30e6e54..05c2ec3 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ sys 0m2.015s |------|---------| | [terraform](#requirement\_terraform) | >= 0.13 | | [aws](#requirement\_aws) | >= 5.14.0 | -| [helm](#requirement\_helm) | >= 2.11.0 | +| [http](#requirement\_http) | >= 2.1.0 | | [kubectl](#requirement\_kubectl) | >= 1.14.0 | | [kubernetes](#requirement\_kubernetes) | >= 2.23.0 | @@ -52,11 +52,10 @@ sys 0m2.015s | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.14.0 | -| [helm](#provider\_helm) | >= 2.11.0 | -| [http](#provider\_http) | n/a | -| [kubectl](#provider\_kubectl) | >= 1.14.0 | -| [kubernetes](#provider\_kubernetes) | >= 2.23.0 | +| [aws](#provider\_aws) | 5.61.0 | +| [http](#provider\_http) | 3.4.4 | +| [kubectl](#provider\_kubectl) | 1.14.0 | +| [kubernetes](#provider\_kubernetes) | 2.31.0 | ## Modules @@ -69,29 +68,23 @@ sys 0m2.015s | Name | Type | |------|------| -| [aws_autoscaling_group_tag.on-demand](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group_tag) | resource | -| [helm_release.cluster-autoscaler](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [kubectl_manifest.deploy_cluster_roles](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | | [kubernetes_namespace.operators](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_storage_class.ebs_encrypted](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | -| [kubernetes_storage_class.efs-sc](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | +| [kubernetes_storage_class.efs_sc](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | | [kubernetes_storage_class.gp3_encrypted](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | | [aws_ebs_default_kms_key.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ebs_default_kms_key) | data source | -| [aws_iam_role.cluster_autoscaler_irsa_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_role) | data source | | [aws_kms_key.ebs_key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source | | [http_http.cluster_roles](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | | [kubectl_file_documents.access_documents](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/data-sources/file_documents) | data source | -| [kubernetes_namespace.kube-system](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/namespace) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [cluster\_autoscaler\_chart\_version](#input\_cluster\_autoscaler\_chart\_version) | The helm chart of the cluster-autoscaler most closely matching the Kuberentes version. Review output of `helm add repo autoscaler 'https://kubernetes.github.io/autoscaler'` (if the repo hasn't been added previously) and `helm search repo -l autoscaler/cluster-autoscaler` | `string` | `"9.37.0"` | no | -| [cluster\_autoscaler\_tag](#input\_cluster\_autoscaler\_tag) | Image tag of cluster-autoscaler associated with the cluster\_autoscaler\_chart\_version helm chart. `helm show values --version [cluster_autoscaler_chart_version] autoscaler/cluster-autoscaler | grep tag:` | `string` | `"v1.30.0"` | no | | [cluster\_name](#input\_cluster\_name) | EKS cluster name name component used through out the EKS cluster describing its purpose (ex: dice-dev) | `string` | n/a | yes | | [eks\_managed\_node\_groups\_autoscaling\_group\_names](#input\_eks\_managed\_node\_groups\_autoscaling\_group\_names) | List of the autoscaling group names created by EKS managed node groups | `list(string)` | n/a | yes | -| [kubectl\_image\_tag](#input\_kubectl\_image\_tag) | The version of bitnami/kubectl image to use. | `string` | `"1.27.14"` | no | +| [kubectl\_image\_tag](#input\_kubectl\_image\_tag) | The version of bitnami/kubectl image to use. | `string` | `"1.30.4"` | no | | [oidc\_provider\_arn](#input\_oidc\_provider\_arn) | The ARN of the OIDC Provider if `enable_irsa = true` | `string` | n/a | yes | | [operators\_ns](#input\_operators\_ns) | Namespace to create where operators will be installed. | `string` | `"operators"` | no | | [profile](#input\_profile) | AWS config profile | `string` | `""` | no | diff --git a/cluster_autoscaler.tf.off b/cluster_autoscaler.tf.off index 6b8c284..ef30dc9 100644 --- a/cluster_autoscaler.tf.off +++ b/cluster_autoscaler.tf.off @@ -100,5 +100,3 @@ resource "helm_release" "cluster-autoscaler" { value = "true" } } - - diff --git a/efs-filesystem.tf.off b/efs-filesystem.tf.off index a382e08..667f8cd 100644 --- a/efs-filesystem.tf.off +++ b/efs-filesystem.tf.off @@ -145,5 +145,5 @@ output "efs_ap_ids" { ## # resources: ## # requests: ## # storage: 5Gi -## # -## +## # +## diff --git a/eks_console_access.tf b/eks_console_access.tf index 04b9032..a8a0637 100644 --- a/eks_console_access.tf +++ b/eks_console_access.tf @@ -52,4 +52,3 @@ resource "kubectl_manifest" "deploy_cluster_roles" { yaml_body = local.all_access_documents[count.index] } - diff --git a/examples/simple/providers.tf b/examples/simple/providers.tf index d33658b..d4ea6a7 100644 --- a/examples/simple/providers.tf +++ b/examples/simple/providers.tf @@ -1,5 +1,27 @@ terraform { required_version = ">= 1.5.0" + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.14.0" + } + helm = { + source = "hashicorp/helm" + version = ">= 2.11.0" + } + http = { + source = "hashicorp/http" + version = ">= 2.1.0" + } + kubectl = { + source = "gavinbunney/kubectl" + version = ">= 1.14.0" + } + kubernetes = { + source = "hashicorp/kubernetes" + version = ">= 2.23.0" + } + } } provider "aws" { @@ -30,4 +52,3 @@ provider "helm" { token = data.aws_eks_cluster_auth.cluster.token } } - diff --git a/examples/simple/variables.tf b/examples/simple/variables.tf index a822a7d..410de0f 100644 --- a/examples/simple/variables.tf +++ b/examples/simple/variables.tf @@ -42,4 +42,4 @@ variable "tags" { description = "AWS Tags to apply to appropriate resources" type = map(string) default = {} -} \ No newline at end of file +} diff --git a/main.tf b/main.tf index bb47672..0f2a284 100644 --- a/main.tf +++ b/main.tf @@ -7,7 +7,7 @@ data "aws_kms_key" "ebs_key" { locals { base_tags = { "eks-cluster-name" = var.cluster_name - "boc:tf_module_version" = local._module_version + "boc:tf_module_version" = local.module_version "boc:created_by" = "terraform" CostAllocation = var.tag_costallocation } @@ -54,6 +54,8 @@ resource "kubernetes_storage_class" "ebs_encrypted" { } module "efs" { + # tflint-ignore: terraform_module_version + # tflint-ignore: terraform_module_pinned_source source = "git@github.e.it.census.gov:terraform-modules/aws-efs.git" name = var.cluster_name @@ -62,13 +64,12 @@ module "efs" { security_groups = [var.security_group_all_worker_mgmt_id] tags = merge( - local.base_tags, - var.tags, + local.tags, tomap({ "efs.csi.aws.com/cluster" = "true" }), ) } -resource "kubernetes_storage_class" "efs-sc" { +resource "kubernetes_storage_class" "efs_sc" { depends_on = [module.efs] metadata { diff --git a/outputs.tf b/outputs.tf index f31bc10..d2ecdcd 100644 --- a/outputs.tf +++ b/outputs.tf @@ -4,12 +4,12 @@ output "module_name" { description = "The name of this module." - value = local._module_name + value = local.module_name } output "module_version" { description = "The version of this module." - value = local._module_version + value = local.module_version } ################################################################################ diff --git a/requirements.tf b/requirements.tf index 8c1f05b..48cbf58 100644 --- a/requirements.tf +++ b/requirements.tf @@ -6,9 +6,9 @@ terraform { source = "hashicorp/aws" version = ">= 5.14.0" } - helm = { - source = "hashicorp/helm" - version = ">= 2.11.0" + http = { + source = "hashicorp/http" + version = ">= 2.1.0" } kubectl = { source = "gavinbunney/kubectl" diff --git a/variables.tf b/variables.tf index 24a07e5..5c4c702 100644 --- a/variables.tf +++ b/variables.tf @@ -3,6 +3,7 @@ variable "cluster_name" { type = string } +# tflint-ignore: terraform_unused_declarations variable "region" { description = "AWS region" type = string @@ -29,11 +30,13 @@ variable "security_group_all_worker_mgmt_id" { type = string } +# tflint-ignore: terraform_unused_declarations variable "eks_managed_node_groups_autoscaling_group_names" { description = "List of the autoscaling group names created by EKS managed node groups" type = list(string) } +# tflint-ignore: terraform_unused_declarations variable "oidc_provider_arn" { description = "The ARN of the OIDC Provider if `enable_irsa = true`" type = string @@ -60,7 +63,7 @@ variable "tags" { variable "kubectl_image_tag" { description = "The version of bitnami/kubectl image to use." type = string - default = "1.27.14" + default = "1.30.4" } # # helm add repo autoscaler "https://kubernetes.github.io/autoscaler" diff --git a/version.tf b/version.tf index c7a6f55..c03e2db 100644 --- a/version.tf +++ b/version.tf @@ -1,4 +1,4 @@ locals { - _module_name = "tfmod-eks-configuration" - _module_version = "0.0.2" + module_name = "tfmod-eks-configuration" + module_version = "0.0.3" }