-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable the creation of private NAT gateways without internet ga…
…teways fixes #1060
- Loading branch information
pierre
authored and
pierre
committed
Apr 27, 2024
1 parent
c182453
commit 8f62e62
Showing
8 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 | | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.30 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.30 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_ec2_transit_gateway_vpc_attachment.tgw_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) | resource | | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
locals { | ||
tgw_id = "tgw-12345678" | ||
} | ||
|
||
resource "aws_ec2_transit_gateway_vpc_attachment" "tgw_attach" { | ||
subnet_ids = module.vpc.private_subnets | ||
transit_gateway_id = local.tgw_id | ||
vpc_id = module.vpc.vpc_id | ||
} | ||
|
||
module "vpc" { | ||
source = "../.." | ||
|
||
cidr = "10.247.84.0/22" | ||
secondary_cidr_blocks = ["100.120.0.0/16"] | ||
|
||
azs = ["us-west-2a", "us-west-2b", "us-west-2c"] | ||
|
||
create_igw = false | ||
nat_gateway_connectivity_type = "private" | ||
nat_gateway_private_ips = ["10.247.84.122", "10.247.85.204", "10.247.86.117"] | ||
nat_gateway_secondary_private_ip_addresses = [["10.247.84.133"], ["10.247.85.79", "10.247.85.66"], ["10.247.86.64", "10.247.86.47", "10.247.86.181"]] | ||
|
||
# You can automatically set the number of secondary private IPs for the NAT Gateways, that is a conflicting argumebt with nat_gateway_secondary_private_ip_addresses | ||
# nat_gateway_secondary_private_ip_address_count = [1, 2, 3] | ||
|
||
# In this scenario the NAT gateways are created inside public subnets i.e without an igw in the routes. | ||
public_subnets = ["10.247.84.0/24", "10.247.85.0/24", "10.247.86.0/24"] | ||
|
||
# The private subnets are using a range of IPs that belongs to the non routable IP range | ||
private_subnets = ["100.120.4.0/22", "100.120.8.0/22", "100.120.12.0/22"] | ||
|
||
enable_nat_gateway = true | ||
single_nat_gateway = false | ||
one_nat_gateway_per_az = true | ||
|
||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 5.30" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters