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

Refactor conditional creation of NAT gateway for EKS #189

Merged

Conversation

vandrijevik
Copy link
Contributor

In the Terraform module aws/nat_gateway, all resources used have a conditional count attribute, which is dependent on the variable uses_nat_gateway: if the variable is false, count = 0, and otherwise count is set to a value that creates resources.

This PR refactors the conditional creation to be specified on the entire module declaration itself (which is available since Terraform 0.13), in order to simplify the code inside the module itself. The end result is the same, although any users of the module might need to do state mv operations because the internal Terraform address of the resources changes (things that used to be module.eks-vpc-nat-gateway.aws_eip.nat-gw-eip[0] are now module.eks-vpc-nat-gateway[0].aws_eip.nat-gw-eip, for example).

@vandrijevik vandrijevik requested a review from rdunlop February 1, 2021 15:05
@vandrijevik vandrijevik requested a review from a team as a code owner February 1, 2021 15:05
@vandrijevik vandrijevik merged commit 376c595 into master Feb 1, 2021
@vandrijevik vandrijevik deleted the va-refactor-conditionals-for-nat_gateway-module branch February 1, 2021 15:51
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.

3 participants