diff --git a/CHANGELOG.md b/CHANGELOG.md index fda45ab..59ffc31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,3 +3,13 @@ ### 🎨🏗️ Style & Architecture - **repo**: install repo features pre-commit and commitizen + +# CHANGELOG +* 0.0.2 -- 2024-07-30 + - update images module + - formatting + - fix for tags +* 0.0.1 -- 2024-07-22 + - updated version.tf to 0.0.1 + - included module.images in depends on helm charts + - created changelog diff --git a/README.md b/README.md index 5bcb9c9..af6871b 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,7 @@ to loki. -# CHANGELOG -* 0.0.2 -- 2024-07-30 - - update images module - - formatting - - fix for tags -* 0.0.1 -- 2024-07-22 - - updated version.tf to 0.0.1 - - included module.images in depends on helm charts - - created changelog + ## Requirements @@ -28,24 +20,22 @@ to loki. | [aws](#requirement\_aws) | >= 5.14.0 | | [helm](#requirement\_helm) | >= 2.11.0 | | [kubernetes](#requirement\_kubernetes) | >= 2.23.0 | -| [null](#requirement\_null) | >= 3.2.1 | -| [template](#requirement\_template) | >= 2.2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.14.0 | -| [helm](#provider\_helm) | >= 2.11.0 | -| [kubernetes](#provider\_kubernetes) | >= 2.23.0 | +| [aws](#provider\_aws) | 5.61.0 | +| [helm](#provider\_helm) | 2.14.0 | +| [kubernetes](#provider\_kubernetes) | 2.31.0 | ## Modules | Name | Source | Version | |------|--------|---------| | [images](#module\_images) | git@github.e.it.census.gov:terraform-modules/aws-ecr-copy-images.git/ | tf-upgrade | -| [loki-irsa-role](#module\_loki-irsa-role) | git@github.it.census.gov:SOA/tfmod-custom-iam-role-for-service-account-eks.git/ | n/a | -| [loki-s3](#module\_loki-s3) | git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard | tf-upgrade | +| [loki\_irsa\_role](#module\_loki\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | n/a | +| [loki\_s3](#module\_loki\_s3) | git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard | tf-upgrade | ## Resources @@ -55,13 +45,12 @@ to loki. | [kubernetes_namespace.ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_s3_bucket.s3_server_access_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source | -| [kubernetes_namespace.existing-ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/namespace) | data source | +| [kubernetes_namespace.existing_ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/namespace) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [additional\_tags](#input\_additional\_tags) | Additional tags to add to resources created in AWS (s3 bucket, ...) | `map(string)` | `{}` | no | | [canary\_tag](#input\_canary\_tag) | The tag of the grafana/loki-canary image to use. | `string` | `"3.0.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 | | [create\_namespace](#input\_create\_namespace) | Indicates whether the `namespace` needs to be created ('true') or already exists (not `true`) | `string` | `"true"` | no | @@ -78,6 +67,7 @@ to loki. | [rwo\_storage\_class](#input\_rwo\_storage\_class) | Specify the storage class for read/write/once persistent volumes. | `string` | `"gp3-encrypted"` | no | | [sidecar\_tag](#input\_sidecar\_tag) | The version of kiwigrid/k8s-sidecar to use for the gateway. | `string` | `"1.24.3"` | no | | [tag\_costallocation](#input\_tag\_costallocation) | Tag CostAllocation (default) | `string` | `"csvd:infrastructure"` | no | +| [tags](#input\_tags) | Additional tags to add to resources created in AWS (s3 bucket, ...) | `map(string)` | `{}` | no | ## Outputs diff --git a/main.tf b/main.tf index 45a8a59..64a11bd 100644 --- a/main.tf +++ b/main.tf @@ -15,7 +15,7 @@ resource "kubernetes_namespace" "ns" { } } -data "kubernetes_namespace" "existing-ns" { +data "kubernetes_namespace" "existing_ns" { count = var.create_namespace == "true" ? 0 : 1 metadata { @@ -26,18 +26,18 @@ data "kubernetes_namespace" "existing-ns" { locals { tags = merge({ "eks-cluster-name" = var.cluster_name - "boc:tf_module_name" = local._module_name - "boc:tf_module_version" = local._module_version + "boc:tf_module_name" = local.module_name + "boc:tf_module_version" = local.module_version "boc:created_by" = "terraform" CostAllocation = var.tag_costallocation }, var.tags) - ns = try(kubernetes_namespace.ns[0].metadata[0].name, data.kubernetes_namespace.existing-ns[0].metadata[0].name) + ns = try(kubernetes_namespace.ns[0].metadata[0].name, data.kubernetes_namespace.existing_ns[0].metadata[0].name) } -module "loki-irsa-role" { - #source = "git@github.it.census.gov:SOA/tfmod-custom-iam-role-for-service-account-eks.git/?ref=1.0.0" - source = "git@github.it.census.gov:SOA/tfmod-custom-iam-role-for-service-account-eks.git/" +# tflint-ignore: terraform_module_version +module "loki_irsa_role" { + source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks" role_name = "${var.cluster_name}-loki" @@ -49,7 +49,7 @@ module "loki-irsa-role" { "${module.loki-s3.s3_bucket_arn}/*", ] kms_key_arns = [ - "${module.loki-s3.kms_key_arn}" + module.loki-s3.kms_key_arn ] oidc_providers = { diff --git a/requirements.tf b/requirements.tf index 1b7a5da..ae62e15 100644 --- a/requirements.tf +++ b/requirements.tf @@ -14,13 +14,5 @@ terraform { source = "hashicorp/kubernetes" version = ">= 2.23.0" } - null = { - source = "hashicorp/null" - version = ">= 3.2.1" - } - template = { - source = "hashicorp/template" - version = ">= 2.2.0" - } } } diff --git a/s3.tf b/s3.tf index f1b3611..cac37c6 100644 --- a/s3.tf +++ b/s3.tf @@ -9,7 +9,7 @@ data "aws_s3_bucket" "s3_server_access_logs" { bucket = format("inf-logs-%v-%v", local.account_id, var.region) } -module "loki-s3" { +module "loki_s3" { source = "git@github.e.it.census.gov:terraform-modules/aws-s3.git//standard?ref=tf-upgrade" bucket_name = format("%v-loki", var.cluster_name) diff --git a/variables.tf b/variables.tf index b488133..ecad875 100644 --- a/variables.tf +++ b/variables.tf @@ -4,7 +4,7 @@ variable "tag_costallocation" { default = "csvd:infrastructure" } -variable "additional_tags" { +variable "tags" { description = "Additional tags to add to resources created in AWS (s3 bucket, ...)" type = map(string) default = {} diff --git a/version.tf b/version.tf index 8d88b94..77fb555 100644 --- a/version.tf +++ b/version.tf @@ -1,4 +1,4 @@ locals { - _module_name = "tfmod-loki" - _module_version = "0.0.2" + module_name = "tfmod-loki" + module_version = "0.0.2" }