cloudposse / terraform-aws-dynamic-subnets

Terraform module for public and private subnets provisioning in existing VPC
https://cloudposse.com/accelerate
Apache License 2.0
191 stars 165 forks source link

Enable session manager and ssh by adding ssh public keys #141

Closed drselump14 closed 2 years ago

drselump14 commented 2 years ago

what

why

references

Nuru commented 2 years ago

For better NAT instance support, you can use an alternate module such as https://github.com/int128/terraform-aws-nat-instance (we have not vetted it, just noticed it) to create NAT instances and easily connect them to the private subnets.

module "dynamic_subnets" {
  source  = "cloudposse/dynamic-subnets/aws"
  version = "2.0.0"

  nat_gateway_enabled  = false
  nat_instance_enabled = false
  # etc . . .
}

resource "aws_route" "private" {
  count = length(module.dynamic_subnets.private_route_table_ids)

  route_table_id         = module.dynamic_subnets.private_route_table_ids[count.index]
  destination_cidr_block = "0.0.0.0/0"
  network_interface_id   = element(local.nat_instances.*.primary_network_interface_id, count.index)
}

We are not going to invest additional resources on NAT Instance support in this module at this time. We recommend using NAT Gatways instead, and if you want to save money, use a single NAT Gateway rather than one per region.