Create new subnets on a given VPC or export random_string.suffix as output of module.astronomer-enterprise

I have the need to deploy astronomer-enterprise on our production VPC and I’m facing the following:

  • If we don’t pass vpc_id a new VPC is created with its own subnets
  • If we pass vpc_id, we MUST pass private_subnets setting, also:
    • The private_subnets must exist before deploying
    • The private_subnets are modified, tag kubernetes.io/cluster/astronomer-XXXXXXXX is set when deploying

I tried to create the subnets with resource "aws_subnet" "foo" but I always get the output that the subnet tags are modified, so my changes don’t seem to be idempotent

It would be nice to:

A) Create new subnets on a given VPC if no private_subnets are passed to module.astronomer-enterprise, this avoids the need for manual creation.

B) Export random_string.suffix as output of module.astronomer-enterprise. I can see the string on the output of terraform show but I can’t access it since its not marked as output:

# module.astronomer-enterprise.module.aws.random_string.suffix:
resource "random_string" "suffix" {
    id          = "XXXXXXXX"
    ...
}