Open ghost opened 1 year ago
I think it's not a bug but rather a limitation of AWS Availability Zones. If you don't explicitly specify a zone there is a chance you might endup in a Local Zone and they do not support IPV6:
The only Local Zones that support IPv6 are us-west-2-lax-1a and use-west-2-lax-1b.
I was able to simulate your problem using a local zone:
variable "awsAz1" {
description = "Availability zone, will dynamically choose one if left empty"
type = string
default = "us-east-1-atl-1a" # local-zone causes your error
}
But if you choose a normal zone there is no error:
variable "awsAz1" {
description = "Availability zone, will dynamically choose one if left empty"
type = string
default = "us-east-1a" # normal zone no error
}
It's because data from availability zones is returning a local zone as first element:
Using terraform console
:
> data.aws_availability_zones.available.names
tolist([
"us-east-1-atl-1a",
"us-east-1-bos-1a",
"us-east-1-bue-1a",
"us-east-1-chi-1a",
"us-east-1-dfw-1a",
"us-east-1-iah-1a",
"us-east-1-lim-1a",
"us-east-1-mci-1a",
"us-east-1-mia-1a",
"us-east-1-msp-1a",
"us-east-1-nyc-1a",
"us-east-1-phl-1a",
"us-east-1-qro-1a",
"us-east-1-scl-1a",
"us-east-1-wl1-atl-wlz-1",
"us-east-1-wl1-bna-wlz-1",
"us-east-1-wl1-bos-wlz-1",
"us-east-1-wl1-chi-wlz-1",
"us-east-1-wl1-clt-wlz-1",
"us-east-1-wl1-dfw-wlz-1",
"us-east-1-wl1-dtw-wlz-1",
"us-east-1-wl1-iah-wlz-1",
"us-east-1-wl1-mia-wlz-1",
"us-east-1-wl1-msp-wlz-1",
"us-east-1-wl1-nyc-wlz-1",
"us-east-1-wl1-tpa-wlz-1",
"us-east-1-wl1-was-wlz-1",
"us-east-1a", # those should have been the first ones in my opinion
"us-east-1b",
"us-east-1c",
"us-east-1d",
"us-east-1e",
"us-east-1f",
])
There are some filters you can specify to exclude local zones:
data "aws_availability_zones" "available" {
state = "available"
filter {
name = "opt-in-status"
values = ["opt-in-not-required"] # exclude local zones
}
}
Which will not show those strange zones:
> data.aws_availability_zones.available.names
tolist([
"us-east-1a",
"us-east-1b",
"us-east-1c",
"us-east-1d",
"us-east-1e",
"us-east-1f",
])
Let us see if that works for you.
Terraform Core Version
1.4.6
AWS Provider Version
5.2.0
Affected Resource(s)
aws_subnet
Expected Behavior
The subnet should be provisioned with the statically defined IPv4 and automatically defined IPv6 supernets and subnets.
I am unable to auto assign IPv6 cidr ranges to new aws_subnets.
I understand this subnet has to be a /64, which it is. It's being calculated out of the /56 automatically generated for the VPC from AWS. I'm not sure why this is not working as that is a valid IPv6 subnet.
Actual Behavior
The subnet is not created as I'm told the IPv6 CIDR for the subnet is not correct.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Simply run the plan as shown above.
Debug Output
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None