diff --git a/README.md b/README.md index 8933914..a133e48 100644 --- a/README.md +++ b/README.md @@ -76,12 +76,12 @@ Common issues and solutions: | Name | Version | |------|---------| -| [aws](#provider\_aws) | ~> 5.14 | -| [aws.eecr](#provider\_aws.eecr) | ~> 5.14 | -| [helm](#provider\_helm) | ~> 2.11 | -| [kubernetes](#provider\_kubernetes) | ~> 2.23 | -| [null](#provider\_null) | ~> 3.2 | -| [random](#provider\_random) | ~> 3.6 | +| [aws](#provider\_aws) | 5.95.0 | +| [aws.eecr](#provider\_aws.eecr) | 5.95.0 | +| [helm](#provider\_helm) | 2.17.0 | +| [kubernetes](#provider\_kubernetes) | 2.36.0 | +| [null](#provider\_null) | 3.2.4 | +| [random](#provider\_random) | 3.7.2 | ## Modules @@ -128,7 +128,7 @@ Common issues and solutions: | [profile](#input\_profile) | AWS config profile used to upload images into ECR | `string` | `""` | no | | [region](#input\_region) | AWS region | `string` | n/a | yes | | [service\_name](#input\_service\_name) | The name of the service to be deployed in the EKS cluster. | `string` | `"service"` | no | -| [utilities\_tag](#input\_utilities\_tag) | Version tag for the docker image to use to execute kubectl commands. | `string` | `"1.0.3"` | no | +| [utilities\_tag](#input\_utilities\_tag) | Used for chown and curl. | `string` | `"1.0.3"` | no | ## Outputs diff --git a/copy_images.tf b/copy_images.tf index 0dd161d..5ef42b1 100644 --- a/copy_images.tf +++ b/copy_images.tf @@ -3,7 +3,7 @@ locals { keycloak_key = format("%v#%v", local.keycloak_name, var.keycloak_tag) postgresql_key = format("%v#%v", "bitnami/postgresql", var.postgresql_tag) postgres_exporter_key = format("%v#%v", "bitnami/postgres-exporter", var.postgres_exporter_tag) - kubectl_key = format("%v#%v", "bitnami/kubectl-debian", var.utilities_tag) + utilities_key = format("%v#%v", "utilities", var.utilities_tag) ent_ecr_source = format("%v.%v.%v.%v", var.eecr_info.account_id, "dkr.ecr", var.region, "amazonaws.com/ent-images") image_config = [ @@ -37,7 +37,7 @@ locals { { enabled = true dest_path = null - name = "bitnami/kubectl-debian" + name = "utilities" source_image = "big-bang/utilities" source_registry = format("%v/%v", local.ent_ecr_source, "ironbank") source_tag = var.utilities_tag diff --git a/main.tf b/main.tf index c601857..4d4ff2a 100644 --- a/main.tf +++ b/main.tf @@ -70,7 +70,6 @@ resource "kubernetes_namespace" "keycloak" { module "service_account" { # tflint-ignore: terraform_module_pinned_source source = "git::https://github.e.it.census.gov/SCT-Engineering/tfmod-config-job.git//service-account" - # source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-config-job.git//service-account" namespace = kubernetes_namespace.keycloak.metadata[0].name } @@ -78,16 +77,13 @@ module "service_account" { module "pre_install" { # tflint-ignore: terraform_module_pinned_source source = "git::https://github.e.it.census.gov/SCT-Engineering/tfmod-config-job.git//config-job" - # source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-config-job.git//config-job" namespace = kubernetes_namespace.keycloak.metadata[0].name service_account_name = module.service_account.service_account_name job_name = "keycloak-config-secret-job" config_script = local.secrets_job_script - kubectl_img = module.images.images[local.kubectl_key].dest_full_path - init_img = module.images.images[local.kubectl_key].dest_full_path - - timeout = "5m" + utilities_image_path = module.images.images[local.utilities_key].dest_full_path + timeout = "5m" } resource "helm_release" "keycloak-db" { @@ -102,7 +98,9 @@ resource "helm_release" "keycloak-db" { depends_on = [ data.kubernetes_secret.db-secrets, - module.images + module.images, + module.service_account, + module.pre_install ] set { @@ -142,16 +140,12 @@ data "kubernetes_secret" "db-secrets" { module "keycloak_db_config" { # tflint-ignore: terraform_module_pinned_source source = "git::https://github.e.it.census.gov/SCT-Engineering/tfmod-config-job.git//config-job" - # source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-config-job.git//config-job" - - depends_on = [helm_release.keycloak-db] - namespace = kubernetes_namespace.keycloak.metadata[0].name + namespace = helm_release.keycloak-db.namespace service_account_name = module.service_account.service_account_name job_name = "keycloak-db-config-job" config_script = local.db_config_job_script - kubectl_img = module.images.images[local.kubectl_key].dest_full_path - init_img = module.images.images[local.kubectl_key].dest_full_path + utilities_image_path = module.images.images[local.utilities_key].dest_full_path timeout = "3m" } @@ -164,7 +158,7 @@ resource "helm_release" "keycloak" { repository = "${path.module}/charts" timeout = 600 wait = true - depends_on = [helm_release.keycloak-db] + depends_on = [helm_release.keycloak-db, module.keycloak_db_config] values = [templatefile("${path.module}/keycloak-server-values.yaml", { hostname = format("https://%v.%v", var.keycloak_hostname, var.cluster_domain) @@ -195,22 +189,19 @@ module "ingress_resources" { public_hostname = var.service_name public_domain = var.cluster_domain service_name = "keycloak-keycloakx-http" - service_namespace = var.keycloak_namespace + service_namespace = kubernetes_namespace.keycloak.metadata[0].name service_port = local.public_port_number } module "post_install" { - depends_on = [helm_release.keycloak] # tflint-ignore: terraform_module_pinned_source source = "git::https://github.e.it.census.gov/SCT-Engineering/tfmod-config-job.git//config-job" - # source = "git@github.e.it.census.gov:SCT-Engineering/tfmod-config-job.git//config-job" - namespace = kubernetes_namespace.keycloak.metadata[0].name + namespace = helm_release.keycloak.namespace service_account_name = module.service_account.service_account_name job_name = "keycloak-config-job" config_script = local.config_job_script - kubectl_img = module.images.images[local.kubectl_key].dest_full_path - init_img = module.images.images[local.kubectl_key].dest_full_path + utilities_image_path = module.images.images[local.utilities_key].dest_full_path timeout = "10m" } diff --git a/variables.tf b/variables.tf index 8d2e93a..20ade53 100644 --- a/variables.tf +++ b/variables.tf @@ -107,8 +107,10 @@ variable "service_name" { type = string default = "service" } + +# From bigbang utilities variable "utilities_tag" { - description = "Version tag for the docker image to use to execute kubectl commands." + description = "Used for chown and curl." type = string default = "1.0.3" }