Skip to content

Commit

Permalink
Copy images (#15)
Browse files Browse the repository at this point in the history
* pointing ecr images to eecr account

* fixed ecr images issues
  • Loading branch information
nangu001 committed Apr 14, 2025
1 parent 845344d commit 96308aa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
34 changes: 25 additions & 9 deletions copy_images.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
locals {
pilot_key = format("%v#%v", "istio/pilot", var.istio_version)
proxy_key = format("%v#%v", "istio/proxyv2", var.istio_version)
pilot_key = format("%v#%v", "istio/pilot", var.istio_version)
proxy_key = format("%v#%v", "istio/proxyv2", var.istio_version)
ent_ecr_source = format("%v.%v.%v.%v", var.account_id, "dkr.ecr", var.region, "amazonaws.com/ent-images")

image_config = [
{
enabled = true
dest_path = null
name = "istio/pilot"
source_image = "istio/pilot"
source_registry = "docker.io"
source_image = "opensource/istio/pilot"
source_registry = format("%v/%v", local.ent_ecr_source, "ironbank")
source_tag = var.istio_version
tag = var.istio_version
},
{
enabled = true
dest_path = null
name = "istio/proxyv2"
source_image = "istio/proxyv2"
source_registry = "docker.io"
source_image = "opensource/istio/proxyv2"
source_registry = format("%v/%v", local.ent_ecr_source, "ironbank")
source_tag = var.istio_version
tag = var.istio_version
},
Expand All @@ -32,7 +33,22 @@ module "images" {
image_config = local.image_config
tags = {}

enable_lifecycle_policy = true
lifecycle_policy_all = true
force_delete = true
enable_lifecycle_policy = true
lifecycle_policy_all = true
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

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" "token" {
registry_id = var.account_id
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable "account_id" {
description = "aws account number"
type = string
default = ""
}

variable "profile" {
description = "AWS_PROFILE to use to apply the terraform script."
type = string
Expand Down

0 comments on commit 96308aa

Please sign in to comment.