Skip to content

Commit

Permalink
fixed ecr login in example
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzzimmer committed Sep 18, 2024
1 parent fb5dc46 commit 031a8d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions examples/complete/data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
data "aws_caller_identity" "current" {}

data "aws_availability_zones" "available" {
state = "available"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ resource "aws_security_group" "egress_all" {

resource "null_resource" "initial_image" {
provisioner "local-exec" {
command = "aws ecr get-login-password --region ${var.region} | docker login --username AWS --password-stdin ${module.service.ecr_repository_url}"
command = "aws ecr get-login-password --region ${var.region} | docker login --username AWS --password-stdin ${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.region}.amazonaws.com"
}

provisioner "local-exec" {
Expand Down
7 changes: 6 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ output "ecr_repository_arn" {
value = join("", module.ecr[*].arn)
}

output "ecr_repository_id" {
description = "The registry ID where the repository was created."
value = join("", module.ecr[*].registry_id)
}

output "ecr_repository_url" {
description = "URL of the ECR repository."
description = "The URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`)"
value = join("", module.ecr[*].repository_url)
}

Expand Down

0 comments on commit 031a8d2

Please sign in to comment.