diff --git a/README.md b/README.md index f487b89..3dff98b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the | Name | Version | |------|---------| | [aws](#provider\_aws) | 6.15.0 | +| [aws.eecr](#provider\_aws.eecr) | 6.15.0 | | [helm](#provider\_helm) | 3.0.2 | | [null](#provider\_null) | 3.2.4 | @@ -46,6 +47,8 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the | [null_resource.git_version](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [aws_arn.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_ecr_authorization_token.ecr_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_authorization_token) | data source | +| [aws_ecr_authorization_token.token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_authorization_token) | data source | | [aws_ecr_image.karpenter_image](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_image) | data source | ## Inputs diff --git a/copy_images.tf b/copy_images.tf index 957b5ac..d6e9145 100644 --- a/copy_images.tf +++ b/copy_images.tf @@ -1,17 +1,17 @@ locals { - karpenter_key = format("%v#%v", "karpenter/controller", var.karpenter_tag) - # ent_ecr_source = format("%v.%v.%v.%v", var.eecr_info.account_id, "dkr.ecr", var.region, "amazonaws.com/ent-images") + karpenter_key = format("%v#%v", "karpenter/controller", var.karpenter_tag) + ent_ecr_source = format("%v.%v.%v.%v", var.eecr_info.account_id, "dkr.ecr", var.region, "amazonaws.com/ent-images") image_config = [ { - enabled = true - dest_path = null - name = "karpenter/controller" - source_image = "karpenter/controller" - source_registry = "public.ecr.aws" - # source_registry = format("%v/%v", local.ent_ecr_source, "public-ecr") - source_tag = var.karpenter_tag - tag = var.karpenter_tag + enabled = true + dest_path = null + name = "karpenter/controller" + source_image = "karpenter/controller" + # source_registry = "public.ecr.aws" + source_registry = format("%v/%v", local.ent_ecr_source, "public-ecr") + source_tag = var.karpenter_tag + tag = var.karpenter_tag }, ] } @@ -29,27 +29,27 @@ module "images" { force_delete = true lifecycle_policy_keep_count = 5 - # source_username = data.aws_ecr_authorization_token.ecr_token.user_name - # source_password = data.aws_ecr_authorization_token.ecr_token.password + source_username = data.aws_ecr_authorization_token.ecr_token.user_name + source_password = data.aws_ecr_authorization_token.ecr_token.password - # destination_username = data.aws_ecr_authorization_token.token.user_name - # destination_password = data.aws_ecr_authorization_token.token.password + destination_username = data.aws_ecr_authorization_token.token.user_name + destination_password = data.aws_ecr_authorization_token.token.password } -# data "aws_ecr_authorization_token" "token" { -# registry_id = var.account_id -# } +data "aws_ecr_authorization_token" "token" { + registry_id = var.account_id +} -# data "aws_ecr_authorization_token" "ecr_token" { -# provider = aws.eecr -# registry_id = var.eecr_info.account_id -# } +data "aws_ecr_authorization_token" "ecr_token" { + provider = aws.eecr + registry_id = var.eecr_info.account_id +} -# provider "aws" { -# alias = "eecr" -# profile = var.eecr_info.profile -# region = var.eecr_info.region -# } +provider "aws" { + alias = "eecr" + profile = var.eecr_info.profile + region = var.eecr_info.region +} output "image_config" { description = "Map of image references to their full source paths"