terraform-provider-ko icon indicating copy to clipboard operation
terraform-provider-ko copied to clipboard

ECR UX needs work

Open mattmoor opened this issue 2 years ago • 1 comments

ECR forces the pre-creation of repositories, so ideally we would have a UX like:

resource "aws_ecr_repository" "foo" {
  name                 = "foo"
  image_tag_mutability = "MUTABLE"

  image_scanning_configuration {
    scan_on_push = false
  }
}

resource "ko_image" "image" {
  base_image  = "cgr.dev/chainguard/static"
  working_dir = path.module
  importpath  = "github.com/mattmoor/foo"

  # NEW!
  repo = aws_ecr_repository.foo.repository_url
}

This would be the equivalent of:

KO_DOCKER_REPO=${aws_ecr_repository.foo.repository_url} ko build --bare github.com/mattmoor/foo

I know @nsmith5 used this to deploy some stuff to AWS, so I'm curious whether this resonates with him (when he's back!).

cc @imjasonh

mattmoor avatar Dec 16 '22 17:12 mattmoor

Is there anything we might want ko_image to do if it can tell that the ECR repo has immutable tags?

resource "ko_image" "image" {
  image_tag_immutability = aws_ecr_repository.foo.image_tag_immutability
}

imjasonh avatar Dec 16 '22 17:12 imjasonh