Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible nat instance provision #73

Closed
puzzloholic opened this issue Oct 6, 2019 · 3 comments · Fixed by #159
Closed

More flexible nat instance provision #73

puzzloholic opened this issue Oct 6, 2019 · 3 comments · Fixed by #159
Labels
wontfix This will not be worked on

Comments

@puzzloholic
Copy link

Hi,

There is I want to custom about nat instance other than just instance_type. Could you expose more variables upon customizing the instance?
Changes I would like to apply:

Thank you.

@khonourhmrc
Copy link

particularly would like the ability to associate a key pair to the nat instances

@Nuru
Copy link
Sponsor Contributor

Nuru commented May 12, 2022

With v2 of this module, you can suppress the NAT Instance creation, create your own NAT instances however you like, and add routes to them, so there is a workaround available. However, NAT Instances are deprecated and do not support NAT64. I am therefore not inclined to add additional support for them.

@Nuru
Copy link
Sponsor Contributor

Nuru commented May 13, 2022

You can use a module like https://github.com/int128/terraform-aws-nat-instance (we have not vetted it, just noticed it) to create your own NAT instance outside of the dynamic-subnets module and then all you need to do is attach default routes to it:

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)
}

@Nuru Nuru closed this as completed in #159 May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants