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

[Bug]: aws_vpn_connection incorrect validation of inside_ipv6_cidr #36232

Closed
erikjoh opened this issue Mar 6, 2024 · 3 comments · Fixed by #36236
Closed

[Bug]: aws_vpn_connection incorrect validation of inside_ipv6_cidr #36232

erikjoh opened this issue Mar 6, 2024 · 3 comments · Fixed by #36236
Labels
bug Addresses a defect in current functionality. service/vpnsite Issues and PRs that pertain to the vpnsite service.
Milestone

Comments

@erikjoh
Copy link
Contributor

erikjoh commented Mar 6, 2024

Terraform Core Version

1.7.4

AWS Provider Version

5.39.1

Affected Resource(s)

  • aws_vpn_connection

Expected Behavior

tunnel1_inside_ipv6_cidr and tunnel2_inside_ipv6_cidr should accept all possible cidrs within fd00::/8 .

For example fdff:1::1337:0:0/126 is within fd00::/8 :

$ ipcalc fd00::/8
Full Network:	fd00:0000:0000:0000:0000:0000:0000:0000/8
Network:	fd00::/8
Netmask:	ff00:: = 8

Address space:	Unique Local Unicast
HostMin:	fd00::
HostMax:	fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Hosts/Net:	2^(120) = 1329227995784915872903807060280344576

Actual Behavior

tunnel1_inside_ipv6_cidr and tunnel2_inside_ipv6_cidr only accept cidrs within fd00::/16 .

$ ipcalc fd00::/16
Full Network:	fd00:0000:0000:0000:0000:0000:0000:0000/16
Network:	fd00::/16
Netmask:	ffff:: = 16

Address space:	Unique Local Unicast
HostMin:	fd00::
HostMax:	fd00:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Hosts/Net:	2^(112) = 5192296858534827628530496329220096

Relevant Error/Panic Output Snippet

╷
│ Error: invalid value for tunnel1_inside_ipv6_cidr (must be within fd00::/8)
│ 
│   with aws_vpn_connection.vpn-alpha,
│   on main.tf line 16, in resource "aws_vpn_connection" "vpn-alpha":
│   16:   tunnel1_inside_ipv6_cidr = "fdff:1::1337:0:0/126"
│ 
╵
╷
│ Error: invalid value for tunnel2_inside_ipv6_cidr (must be within fd00::/8)
│ 
│   with aws_vpn_connection.vpn-alpha,
│   on main.tf line 17, in resource "aws_vpn_connection" "vpn-alpha":
│   17:   tunnel2_inside_ipv6_cidr = "fdff:1::1337:1:0/126"
│ 
╵

Terraform Configuration Files

terraform {
  required_version = "~> 1.7.4"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">=5.39.1"
    }
  }
}

resource "aws_vpn_connection" "vpn-alpha" {
  customer_gateway_id      = "foo"
  transit_gateway_id       = "bar"
  type                     = "ipsec.1"
  tunnel1_inside_ipv6_cidr = "fdff:1::1337:0:0/126"
  tunnel2_inside_ipv6_cidr = "fdff:1::1337:1:0/126"
}

Steps to Reproduce

  • Put config in a main.tf file.
  • Run terraform init
  • Run terraform plan

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

From the docs https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_VpnTunnelOptionsSpecification.html

TunnelInsideIpv6Cidr
The range of inside IPv6 addresses for the tunnel. Any specified CIDR blocks must be unique across all VPN connections that use the same transit gateway.

Constraints: A size /126 CIDR block from the local fd00::/8 range.

Type: String

Required: No

And the incorrect regex validation that causes this error:

validation.StringMatch(regexache.MustCompile(`^fd00:`), "must be within fd00::/8"),

Would you like to implement a fix?

Yes

@erikjoh erikjoh added the bug Addresses a defect in current functionality. label Mar 6, 2024
@github-actions github-actions bot added the service/vpnsite Issues and PRs that pertain to the vpnsite service. label Mar 6, 2024
Copy link

github-actions bot commented Mar 6, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 6, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 7, 2024
@github-actions github-actions bot added this to the v5.41.0 milestone Mar 11, 2024
Copy link

This functionality has been released in v5.41.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpnsite Issues and PRs that pertain to the vpnsite service.
Projects
None yet
2 participants