Skip to content

Commit ff32b29

Browse files
aknyshclaude
andcommitted
Update to terraform-aws-dynamic-subnets v3.0.1
Updated the aws-vpc component to use terraform-aws-dynamic-subnets v3.0.1, which includes a critical bug fix for NAT Gateway routing when max_nats is set to fewer than the number of Availability Zones. **Changes:** 1. **src/main.tf**: Updated module version from 3.0.0 to 3.0.1 2. **README.yaml**: Updated all references to v3.0.1 - Added note about NAT routing bug fix - Updated related links to point to v3.0.1 release 3. **README.md & src/README.md**: Regenerated from README.yaml - Module version updated in tables - Feature list includes bug fix note - Related links updated 4. **docs/prd/upgrade-to-dynamic-subnets-v3.md**: - Updated title and version to 3.0.1 - Added executive summary note about v3.0.1 patch - Updated all code examples to show v3.0.1 - Changed "After (v3.0.0)" to "After (v3.0.x)" for clarity - Added v3.0.1 bug fix to success criteria - Added v1.2 changelog entry - Updated PRD version to 1.2 and date to 2025-11-03 **v3.0.1 Release Notes:** The v3.0.1 patch fixes a critical bug where NAT Gateway routing failed with "Invalid index" error when max_nats was set to fewer than the number of AZs. This was caused by route tables attempting to reference non-existent NAT indices. The fix adds modulo operations to the route table mapping formulas, ensuring all route tables correctly reference available NAT Gateways. **Testing:** All existing tests pass without modification. The component test suite comprehensively validates: - NAT placement by index (TestNATPlacementByIndex) - NAT placement by name (TestNATPlacementByName) - Separate subnet counts (TestSeparateSubnetCounts) - All other VPC configurations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 08a390f commit ff32b29

File tree

5 files changed

+39
-31
lines changed

5 files changed

+39
-31
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ description: |-
1414
- VPC Endpoints for AWS services (S3, DynamoDB, and interface endpoints)
1515
- AWS Shield Advanced protection for NAT Gateway EIPs (optional)
1616
17-
**What's New in v3.0.0:**
18-
- Uses `terraform-aws-dynamic-subnets` v3.0.0 with enhanced subnet configuration
17+
**What's New in v3.0.1:**
18+
- Uses `terraform-aws-dynamic-subnets` v3.0.1 with enhanced subnet configuration
1919
- Separate public/private subnet counts and names per AZ
2020
- Precise NAT Gateway placement control for cost optimization
2121
- NAT Gateway IDs exposed in subnet stats outputs
2222
- Requires AWS Provider v5.0+
23+
- Fixes critical bug in NAT routing when `max_nats < num_azs`
2324
2425
usage: |-
2526
**Stack Level**: Regional
@@ -229,11 +230,11 @@ references:
229230
description: CloudPosse VPC Module v3.0.0
230231
url: https://github.com/cloudposse/terraform-aws-vpc
231232
- name: terraform-aws-dynamic-subnets
232-
description: CloudPosse Dynamic Subnets Module v3.0.0 - Enhanced subnet configuration with separate public/private control
233+
description: CloudPosse Dynamic Subnets Module v3.0.1 - Enhanced subnet configuration with separate public/private control
233234
url: https://github.com/cloudposse/terraform-aws-dynamic-subnets
234-
- name: terraform-aws-dynamic-subnets v3.0.0 Release
235-
description: Release notes for dynamic-subnets v3.0.0 with new features
236-
url: https://github.com/cloudposse/terraform-aws-dynamic-subnets/releases/tag/v3.0.0
235+
- name: terraform-aws-dynamic-subnets v3.0.1 Release
236+
description: Patch release fixing NAT routing bug when max_nats < num_azs
237+
url: https://github.com/cloudposse/terraform-aws-dynamic-subnets/releases/tag/v3.0.1
237238
tags:
238239
- component/vpc
239240
- layer/network

docs/prd/upgrade-to-dynamic-subnets-v3.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
# Product Requirements Document: Upgrade to dynamic-subnets v3.0.0
1+
# Product Requirements Document: Upgrade to dynamic-subnets v3.0.1
22

3-
**Version:** 1.1
4-
**Date:** 2025-11-02
3+
**Version:** 1.2
4+
**Date:** 2025-11-03
55
**Status:** Implemented
66
**Author:** CloudPosse Team
77

88
---
99

1010
## Executive Summary
1111

12-
This PRD documents the upgrade of the `aws-vpc` component to use the latest `terraform-aws-dynamic-subnets` module version 3.0.0. This upgrade brings significant new capabilities for managing VPC subnets with independent control over public and private subnet counts and flexible NAT Gateway placement options.
12+
This PRD documents the upgrade of the `aws-vpc` component to use the latest `terraform-aws-dynamic-subnets` module version 3.0.1. This upgrade brings significant new capabilities for managing VPC subnets with independent control over public and private subnet counts and flexible NAT Gateway placement options.
13+
14+
**Note:** Version 3.0.1 is a patch release that fixes a critical bug in NAT Gateway routing when `max_nats` is set to fewer than the number of Availability Zones. See the [v3.0.1 Release Notes](https://github.com/cloudposse/terraform-aws-dynamic-subnets/releases/tag/v3.0.1) for details.
1315

1416
### Key Changes
1517

16-
1. **Module Upgrade**: Updated `terraform-aws-dynamic-subnets` from v2.4.2 to v3.0.0
18+
1. **Module Upgrade**: Updated `terraform-aws-dynamic-subnets` from v2.4.2 to v3.0.1
1719
2. **New Subnet Configuration**: Added support for separate public/private subnet counts per AZ
1820
3. **Flexible NAT Placement**: Added support for index-based and name-based NAT Gateway placement
1921
4. **AWS Provider Compatibility**: Updated to support AWS Provider v5.0+ (including v6.x)
@@ -31,7 +33,7 @@ This PRD documents the upgrade of the `aws-vpc` component to use the latest `ter
3133

3234
## Background
3335

34-
The `terraform-aws-dynamic-subnets` module v3.0.0 introduces several major enhancements:
36+
The `terraform-aws-dynamic-subnets` module v3.0.x introduces several major enhancements:
3537

3638
1. **Separate Public/Private Configuration**: Previously, you could only create the same number of public and private subnets per AZ. Now you can configure them independently.
3739

@@ -50,7 +52,7 @@ subnets_per_az_count = 2 # Creates 2 public + 2 private, NATs in both public
5052
max_nats = 1 # Limits to 1 NAT total (not per AZ, global limit)
5153
```
5254

53-
**After (v3.0.0):**
55+
**After (v3.0.x):**
5456
```hcl
5557
public_subnets_per_az_count = 2
5658
private_subnets_per_az_count = 3
@@ -65,7 +67,7 @@ Create different named subnets for public vs private, like "web" and "loadbalanc
6567
subnets_per_az_names = ["common"] # Same names for public and private
6668
```
6769

68-
**After (v3.0.0):**
70+
**After (v3.0.x):**
6971
```hcl
7072
public_subnets_per_az_names = ["web", "loadbalancer"]
7173
private_subnets_per_az_names = ["app", "database", "cache"]
@@ -83,11 +85,12 @@ private_subnets_per_az_names = ["app", "database", "cache"]
8385
```hcl
8486
module "subnets" {
8587
source = "cloudposse/dynamic-subnets/aws"
86-
version = "3.0.0" # Upgraded from 2.4.2
88+
version = "3.0.1" # Upgraded from 2.4.2 (via 3.0.0)
8789
```
8890

8991
**Impact:**
90-
- Access to all new features in dynamic-subnets v3.0.0
92+
- Access to all new features in dynamic-subnets v3.0.x
93+
- v3.0.1 fixes critical bug in NAT routing when `max_nats < num_azs`
9194
- Support for AWS Provider v6.x
9295
- Enhanced subnet configuration capabilities
9396

@@ -159,7 +162,7 @@ variable "nat_gateway_public_subnet_names" {
159162
```hcl
160163
module "subnets" {
161164
source = "cloudposse/dynamic-subnets/aws"
162-
version = "3.0.0"
165+
version = "3.0.1"
163166
164167
# ... existing variables ...
165168
@@ -672,7 +675,7 @@ The module will fail at apply time with a clear error message if invalid names a
672675

673676
### ✅ Completed
674677

675-
1. ✅ Module upgraded to dynamic-subnets v3.0.0
678+
1. ✅ Module upgraded to dynamic-subnets v3.0.1 (from v2.4.2 via v3.0.0)
676679
2. ✅ All 6 new variables added and documented
677680
3. ✅ AWS Provider version updated to v5.0+ ⚠️ **BREAKING CHANGE** (drops v4.x support)
678681
4. ✅ Go and test dependencies updated to latest versions (Go 1.25, Terratest 0.52.0)
@@ -684,13 +687,14 @@ The module will fail at apply time with a clear error message if invalid names a
684687
10. ✅ Comprehensive PRD documentation created with breaking change clearly documented
685688
11. ✅ Added Terraform validation blocks for NAT placement variables (plan-time validation)
686689
12. ✅ Added `check` block for mutual exclusivity validation (catches errors before resource creation)
687-
13. ✅ Added 14 new outputs to expose all dynamic-subnets v3.0.0 capabilities
688-
14. ✅ Added comprehensive test coverage for v3.0.0 features:
690+
13. ✅ Added 14 new outputs to expose all dynamic-subnets v3.0.x capabilities
691+
14. ✅ Added comprehensive test coverage for v3.0.x features:
689692
- TestNATPlacementByIndex - validates index-based NAT placement
690693
- TestNATPlacementByName - validates name-based NAT placement
691694
- TestSeparateSubnetCounts - validates separate public/private subnet counts
692695
- TestValidationMutualExclusivity - validates mutual exclusivity check
693696
15. ✅ Created test stack configurations for all new test cases
697+
16. ✅ v3.0.1 patch applied - fixes critical NAT routing bug when `max_nats < num_azs`
694698

695699
### Future Enhancements
696700

@@ -791,3 +795,4 @@ atmos terraform apply vpc -s <stack>
791795
|---------|------------|-----------------|-----------------------------------------------------------------------------------|
792796
| 1.0 | 2025-11-02 | CloudPosse Team | Initial PRD - upgraded to dynamic-subnets v3.0.0, added 6 new variables, updated test infrastructure |
793797
| 1.1 | 2025-11-02 | CloudPosse Team | Added comprehensive test improvements section, updated README.yaml with usage examples, documented test code enhancements and future test recommendations |
798+
| 1.2 | 2025-11-03 | CloudPosse Team | Updated to dynamic-subnets v3.0.1 - patch release fixing critical NAT routing bug when max_nats < num_azs |

src/README.md

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ module "vpc_endpoints" {
153153

154154
module "subnets" {
155155
source = "cloudposse/dynamic-subnets/aws"
156-
version = "3.0.0"
156+
version = "3.0.1"
157157

158158
availability_zones = local.availability_zones
159159
availability_zone_ids = local.availability_zone_ids

0 commit comments

Comments
 (0)