hardfinhq / terraform-aws-tailscale-subnet-router

Terraform module for Tailscale subnet router in AWS ECS Fargate
https://registry.terraform.io/modules/hardfinhq/tailscale-subnet-router/aws
Apache License 2.0
30 stars 9 forks source link

Feature: Use Image from any registry #1

Open smkjason opened 1 year ago

smkjason commented 1 year ago

Currently, you are forced to use an image from an ECR registry that is in the same AWS account. This means that I have to create ECR across all the AWS accounts where I want to deploy this module. I'd like to be able to specify the image repository as a whole myself so that I'm not forced to create an ECR registry across all AWS accounts.

dhermes commented 1 year ago

Thanks a lot for your feedback!

Do you have a proposal in mind? Would you like to take a stab at sending a PR?

smkjason commented 1 year ago

Yes of course, I'd love to contribute to this project. The goal is to be able to additionally specify the image registry such that I can use the image from outside of ECR in the same AWS account.

Potential Implementation

Take registry as an input and construct the Image ID used in container_definition with the three variables we now have. "${var.registry}/${var.repository}:${var.tag}. This would be a breaking change. I think there are ways to make this non-breaking though. For example, we could make that variable marked optional and check with try() function.

dhermes commented 1 year ago

This would be a breaking change

That's OK with me! We can document it in release notes and it's a SMALL surface area for change.

Regarding try(), I typically use count = var.foo == null ? 0 : 1 with optional resources depending on the use case.