resourceDockerRegistryImageCreate: Unable to get authConfig for registry:
jean-simon-barry1 opened this issue · 2 comments
Description
Hello! When I try to use the docker-build
module, with slightly modified version of the examples provided in this repo, the image builds but fails to push to ECR with resourceDockerRegistryImageCreate: Unable to get authConfig for registry: no auth config found for registry 123456789.dkr.ecr.us-east-1.amazonaws.com in auth configs: map[string]types.AuthConfig(nil)
(account id redacted).
Apologies if this isn't exactly related to this module...but the given example code doesn't work for me. And I can't seem to fix this and it's driving me up the walls!
- ✋ I have searched the open/closed issues and my issue is not listed.
Versions
- Module version [Required]:
latest
Terraform v1.5.0
on darwin_arm64
- provider registry.terraform.io/calxus/docker v3.0.0
- provider registry.terraform.io/hashicorp/aws v5.32.0
- provider registry.terraform.io/hashicorp/null v3.2.2
- provider registry.terraform.io/kreuzwerker/docker v3.0.2
Reproduction Code [Required]
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.32.0"
}
docker = {
source = "calxus/docker"
version = "3.0.0"
}
}
backend "local" {}
required_version = "~> 1.5.0"
}
data "aws_caller_identity" "current" {}
data "aws_ecr_authorization_token" "token" {}
provider "docker" {
registry_auth {
address = "${data.aws_caller_identity.current.account_id}.dkr.ca-central-1.amazonaws.com"
username = data.aws_ecr_authorization_token.token.user_name
password = data.aws_ecr_authorization_token.token.password
}
}
module "docker_image" {
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
ecr_repo = "jsb-repo"
create_ecr_repo = true
platform = "linux/amd64"
use_image_tag = true
image_tag = "latest"
docker_file_path = "${path.module}/Dockerfile"
source_path = path.module
build_args = {}
}
Steps to reproduce the behavior:
- (provide AWS credentials)
- (copy the dummy Dockerfile from examples)
- terraform init && terraform apply
Expected behavior
The repo and image to be created
Actual behavior
I get the error
╷
│ Error: resourceDockerRegistryImageCreate: Unable to get authConfig for registry: no auth config found for registry 123456789.dkr.ecr.us-east-1.amazonaws.com in auth configs: map[string]types.AuthConfig(nil)
│
│ with module.docker_image.docker_registry_image.this,
│ on .terraform/modules/docker_image/modules/docker-build/main.tf line 27, in resource "docker_registry_image" "this":
│ 27: resource "docker_registry_image" "this" {
│
╵
Terminal Output Screenshot(s)
I am an absolute idiot 🙃
address = "${data.aws_caller_identity.current.account_id}.dkr.ca-central-1.amazonaws.com"
was missing .ecr. in the address. Sorry bout that, and thanks for providing this module <3
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.