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

fix: Failed to create NAT gateway for eks-cluster-with-new-vpc example if local zones are enabled #1095

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

aaroniscode
Copy link
Contributor

What does this PR do?

🛑 Please open an issue first to discuss any significant work and flesh out details/direction - we would hate for your time to be wasted.
Consult the CONTRIBUTING guide for submitting pull-requests.

Motivation

Followed the getting started documentation with the eks-cluster-with-new-vpc example and the step

terraform apply -target="module.vpc"

failed with the error

│ Error: error creating EC2 NAT Gateway: NotAvailableInZone: Nat Gateway is not available in this availability zone
│ 	status code: 400, request id: 522ca79d-4c64-4b62-8be9-66b4d5b91014
│
│   with module.vpc.aws_nat_gateway.this[0],
│   on .terraform/modules/vpc/main.tf line 1025, in resource "aws_nat_gateway" "this":
│ 1025: resource "aws_nat_gateway" "this" {
│

Upon investigation, Terraform had selected the Phoenix Local zone to create one of the subnets and then tried to create the NAT gateway in the local zone.

More

  • Yes, I have tested the PR using my local account setup (Provide any test evidence report under Additional Notes)
  • Yes, I have added a new example under examples to support my PR
  • Yes, I have created another PR for add-ons under add-ons repo (if applicable)
  • Yes, I have updated the docs for this feature
  • Yes, I ran pre-commit run -a with this PR

Note: Not all the PRs require a new example and/or doc page. In general:

  • Use an existing example when possible to demonstrate a new addons usage
  • A new docs page under docs/add-ons/* is required for new a new addon

For Moderators

  • E2E Test successfully complete before merge?

Additional Notes

I followed the instructions in the Terraform docs to filter only availability zones.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones#by-filter

Only Availability Zones (no Local Zones):

data "aws_availability_zones" "example" {
  filter {
    name   = "opt-in-status"
    values = ["opt-in-not-required"]
  }
}

@aaroniscode aaroniscode temporarily deployed to EKS Blueprints Test October 27, 2022 15:58 Inactive
@Zvikan Zvikan changed the title fix: failed to create NAT gateway for eks-cluster-with-new-vpc example if local zones are enabled fix: Failed to create NAT gateway for eks-cluster-with-new-vpc example if local zones are enabled Oct 27, 2022
Copy link
Contributor

@Zvikan Zvikan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@Zvikan Zvikan merged commit 0529549 into aws-ia:main Oct 27, 2022
vara-bonthu pushed a commit that referenced this pull request Nov 11, 2022
allamand pushed a commit to allamand/terraform-aws-eks-blueprints that referenced this pull request Dec 15, 2022
allamand pushed a commit to allamand/terraform-aws-eks-blueprints that referenced this pull request Jan 10, 2023
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.

None yet

2 participants