Repository navigation
Support http_protocol_ipv6 in metadata_options - #709
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Phil Sweeney seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
|
Overall, this PR looks great! Optional enhancement: Consider adding validation for the edge case where If you'd like to add this safeguard, something like: if c.Metadata.HttpEndpoint == "disabled" && c.Metadata.HttpProtocolIpv6 == "enabled" {
errs = append(errs, fmt.Errorf(
"http_protocol_ipv6 can only be enabled when http_endpoint is enabled",
))
}This is optional—the PR is solid without it. The same pattern also exists for |
|
Thanks @hariom-hashicorp I will take a look this week. |
Allows configuring the IPv6 IMDS endpoint (`http_protocol_ipv6 = "enabled" | "disabled"`) on launched build instances (both on-demand and spot). When enabled, this allows Nitro instances in dual-stack subnets to access IMDS over IPv6 directly, preventing cloud-init timeouts and boot delays. Closes hashicorp#708
9c94676 to
1e2befe
Compare
|
Thanks for the review @hariom-hashicorp! I've rebased on the latest main and added validation for both cases where http_endpoint = "disabled": Unit tests covering both scenarios have also been added. |
|
Thanks @phils LGTM, ready to merge ✅ |
Description
This PR adds support for AWS EC2's
HttpProtocolIpv6setting (http_protocol_ipv6 = "enabled" | "disabled") to themetadata_optionsconfiguration block.Background & Use Case
AWS EC2 supports accessing instance metadata over IPv6 via
http://[fd00:ec2::254], which is essential for instances launched in IPv6-only subnets or IPv6-first architectures where IPv4 link-local addressing is disabled or not routed.While
packer-plugin-amazonalready supportshttp_endpoint,http_tokens, andhttp_put_response_hop_limit, it lacks support forhttp_protocol_ipv6. Because AWS defaultsHttpProtocolIpv6todisabled, builder instances in IPv6-only environments cannot reach IMDS. Exposinghttp_protocol_ipv6 = "enabled"provides full parity with the AWS EC2 metadata options API and allows builds to run seamlessly in IPv6-only networks.Changes
http_protocol_ipv6toMetadataOptionsstruct incommon(SDK v2) andbuilder/common(SDK v1), defaulting to"disabled"with validation for"enabled"/"disabled".HttpProtocolIpv6toStepRunSourceInstance(RunInstances) andStepRunSpotInstance(CreateLaunchTemplate).Metadata.HttpProtocolIpv6acrossebs,ebssurrogate, andebsvolumebuilders.Resolved Issues
Closes #708
Rollback Plan
If a change needs to be reverted, we will roll out an update to the code within 7 days.
Changes to Security Controls
None. This parameter exposes existing AWS EC2 instance metadata options to control whether the IMDS endpoint is accessible over IPv6.