Skip to content

Guard NAT gateway outputs against empty lists#40

Merged
basebandit merged 2 commits into
chore/refactor-with-enhancementsfrom
copilot/sub-pr-37-another-one
Feb 9, 2026
Merged

Guard NAT gateway outputs against empty lists#40
basebandit merged 2 commits into
chore/refactor-with-enhancementsfrom
copilot/sub-pr-37-another-one

Conversation

Copilot AI commented Feb 9, 2026

Copy link
Copy Markdown

Addresses feedback on PR #37 where NAT gateway outputs directly index arrays without guards, causing Terraform to fail if NAT is disabled or returns empty lists.

Changes:

  • Wrapped module.vpc.nat_public_ips[0] and module.vpc.natgw_ids[0] with try(..., null)
  • Added descriptions clarifying outputs return null when NAT is disabled

Example:

# Before
output "vpc_nat_gateway_static_public_ip" {
  value = module.vpc.nat_public_ips[0]  # Fails if empty
}

# After
output "vpc_nat_gateway_static_public_ip" {
  value       = try(module.vpc.nat_public_ips[0], null)
  description = "Static public IP of the NAT Gateway (null if NAT is disabled)"
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: basebandit <8973567+basebandit@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback from review on refactor and enhancements PR Guard NAT gateway outputs against empty lists Feb 9, 2026
Copilot AI requested a review from basebandit February 9, 2026 05:46
@basebandit basebandit marked this pull request as ready for review February 9, 2026 06:57
@basebandit basebandit merged commit 7cb1a8e into chore/refactor-with-enhancements Feb 9, 2026
@basebandit basebandit deleted the copilot/sub-pr-37-another-one branch February 9, 2026 07:20
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.

2 participants