Last active
March 21, 2023 18:45
-
-
Save briceburg/f9e256f98e6cafed4b34e004f4c095da to your computer and use it in GitHub Desktop.
Terraform ECR authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_ecr_repository" "repo" { | |
name = "foo" | |
} | |
data "aws_ecr_authorization_token" "repo" {} | |
# | |
# providers.tf | |
# | |
terraform { | |
required_providers { | |
docker = { | |
source = "kreuzwerker/docker" | |
version = "3.0.1" | |
} | |
} | |
} | |
# https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs | |
provider "docker" { | |
registry_auth { | |
address = split("/", aws_ecr_repository.repo.repository_url)[0] | |
username = data.aws_ecr_authorization_token.repo.user_name | |
password = data.aws_ecr_authorization_token.repo.password | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment