-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
feat: Added custom route for NAT gateway #748
feat: Added custom route for NAT gateway #748
Conversation
@antonbabenko is it possible to prioritize the review of this PR? Should be a simple change to review. |
variables.tf
Outdated
variable "private_nat_gateway_destination_route" { | ||
description = "Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route." | ||
type = string | ||
default = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't looked in depth, but wouldn't it make more sense to just set the default here as 0.0.0.0/0
and then on line 1046 its just destination_cidr_block = var.private_nat_gateway_destination_cidr_block
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, yes. I just took a conditional approach. Will change that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected. If that works for you, I can resolve this conversation.
…ay_destination_route
variables.tf
Outdated
@@ -298,6 +298,12 @@ variable "enable_nat_gateway" { | |||
default = false | |||
} | |||
|
|||
variable "private_nat_gateway_destination_route" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable "private_nat_gateway_destination_route" { | |
variable "nat_gateway_destination_cidr_block" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now fixed.
@piersf Please fix the docs (run |
@antonbabenko silly question but how do I run |
You need to install it - https://pre-commit.com/#installation and Just let me know if you want me to fix this and release it. |
If you can, I'd really appreciate it. I don't have many of these prerequisites installed like |
## [3.12.0](v3.11.5...v3.12.0) (2022-02-07) ### Features * Added custom route for NAT gateway ([#748](#748)) ([728a4d1](728a4d1))
This PR is included in version 3.12.0 🎉 |
No problems, I've just fixed it. Thank you for your contribution! |
## [3.12.0](terraform-aws-modules/terraform-aws-vpc@v3.11.5...v3.12.0) (2022-02-07) ### Features * Added custom route for NAT gateway ([terraform-aws-modules#748](terraform-aws-modules#748)) ([728a4d1](terraform-aws-modules@728a4d1))
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
When having a VPC with public and private subnets, there are cases where traffic from the private subnet that is destined for
0.0.0.0/0
does not need to go to the NAT Gateway but instead, it should be sent to another destination (e.g., transit gateway). And then only specific traffic that is destined for the internet (e.g., 8.8.8.8/32) should be sent to the NAT Gateway.Therefore, this change adds a new conditional variable that enables us to pass a custom destination CIDR block for the NAT Gateway.
Motivation and Context
When having a VPC with public and private subnets, there are cases where traffic from the private subnet that is destined for
0.0.0.0/0
does not need to go to the NAT Gateway but instead, it should be sent to another destination (e.g., transit gateway). And then only specific traffic that is destined for the internet (e.g., 8.8.8.8/32) should be sent to the NAT Gateway.Breaking Changes
No breaking changes were noticed.
How Has This Been Tested?
examples/*
projects