From e3f685b83081e3c599ed8efffc75c0cb34ba3f76 Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Thu, 17 Apr 2025 14:17:13 -0400 Subject: [PATCH] pull across accounts from central ecr --- README.md | 5 +++++ copy_images.tf | 21 +++++++++++---------- requirements.tf | 4 ++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6dce16e..6167557 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13 | +| [aws](#requirement\_aws) | >= 5.14.0 | | [helm](#requirement\_helm) | >= 2.11.0 | | [kubernetes](#requirement\_kubernetes) | >= 2.23.0 | @@ -13,6 +14,8 @@ | Name | Version | |------|---------| +| [aws](#provider\_aws) | 5.94.1 | +| [aws.eecr](#provider\_aws.eecr) | 5.94.1 | | [helm](#provider\_helm) | 2.17.0 | ## Modules @@ -27,6 +30,8 @@ |------|------| | [helm_release.kiali](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.kiali_operator](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [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 | ## Inputs diff --git a/copy_images.tf b/copy_images.tf index 82edd1e..5398783 100644 --- a/copy_images.tf +++ b/copy_images.tf @@ -39,17 +39,18 @@ 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" "ecr_token" { -# registry_id = var.account_id -# } +data "aws_ecr_authorization_token" "ecr_token" { + provider = aws.eecr + registry_id = var.eecr_account_id +} -# data "aws_ecr_authorization_token" "token" { -# registry_id = var.account_id -# } +data "aws_ecr_authorization_token" "token" { + registry_id = var.account_id +} diff --git a/requirements.tf b/requirements.tf index 5f150af..ae62e15 100644 --- a/requirements.tf +++ b/requirements.tf @@ -2,6 +2,10 @@ terraform { required_version = ">= 0.13" required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.14.0" + } helm = { source = "hashicorp/helm" version = ">= 2.11.0"