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

remove check for existing ips on local.nat_gateways_count #109

Conversation

joe-niland
Copy link
Member

what

  • Removed check which caused NAT instances/gateways not to be created if existing Elastic IPs provided
  • It's not clear why this check was added

why

  • We need the ability to assign existing elastic IPs to NAT instances/gateways

references

@joe-niland joe-niland requested review from a team as code owners December 18, 2020 04:48
@joe-niland joe-niland requested review from dotCipher and adamcrews and removed request for a team December 18, 2020 04:48
@joe-niland
Copy link
Member Author

@etwillbefine I was wondering why this check was added: https://github.com/cloudposse/terraform-aws-dynamic-subnets/pull/86/files#diff-994b65bfe2a964a586187336675fc84a4099482f4444273426a95fc0a79f62c7R11

This PR removes it but it'd be good to know if it served a particular purpose, as I am not sure!

@joe-niland
Copy link
Member Author

/test all

maximmi
maximmi previously approved these changes Dec 18, 2020
Copy link
Contributor

@maximmi maximmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joe-niland I don't know why this check was implemented in first place, but as soon as this fix makes things works it LGTM

Nuru
Nuru previously requested changes Dec 18, 2020
Copy link
Contributor

@Nuru Nuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joe-niland @maximmi @osterman @aknysh I am worried this PR changes the existing behavior in an incompatible way. Despite the language in #42, which was closed by PR #86 which introduced "existing IPs", and the description of the existing_nat_ips, the current behavior is that if you provide existing IPs, they are assumed to be connected to existing NAT gateways or instances. No new gateways are created. "existing_nat_ips" is interpreted to mean the IPs of existing NATs.

That said, the existing behavior makes no sense. Nothing is done with the existing IPs, all that happens is that if you provide them, no NATs are created. The same effect could be achieved by setting both nat_gateway_enabled and nat_instance_enabled to false.

So I propose a breaking change that renames existing_nat_ips to anything else, maybe nat_elastic_ips, so that anyone using existing_nat_ips will be notified about the change in behavior, which otherwise could go unnoticed and be expensive.

Intentional breaking change to indicate the actual use of this variable.
@joe-niland
Copy link
Member Author

@Nuru @maximmi sorry, I should have pinged you guys directly.

@Nuru great point. I agree that the original intention of this variable seems to be to support existing NAT devices. It seems that there was an attempt at https://github.com/cloudposse/terraform-aws-dynamic-subnets/blob/master/nat-gateway.tf#L35 but it's contradicted by the check above.

I didn't consider the important cost implication of this change!

I've made the suggested change.

@mergify mergify bot dismissed Nuru’s stale review December 18, 2020 11:00

This Pull Request has been updated, so we're dismissing all reviews.

@joe-niland joe-niland requested a review from a team as a code owner December 18, 2020 11:01
@joe-niland
Copy link
Member Author

/test all

@joe-niland
Copy link
Member Author

/test all

@osterman
Copy link
Member

I agree with @Nuru 's recommendations.

@osterman
Copy link
Member

(I take responsiblity for #86 =) - I thought it was just reusing existing Elastic IPs and associating them with a new NAT gateway or instance)

@Nuru Nuru merged commit b9f5836 into cloudposse:master Dec 18, 2020
@joe-niland joe-niland deleted the bugfix/nat-gateway-instance-not-created-with-existing-ips branch March 7, 2021 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nat instances not created when using pre existing eips
4 participants