-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
amazon: Impossible to associate public IP in default subnet w/o auto-assign public IP #6589
Comments
I'm not sure I follow? Do you think this is a bug? To me what you describe is the intended behaviour. |
intended behaviour is if I set |
Ok, I got it. I'll edit the original post to make it clearer. |
This issue will bite allot of people, can we have some verbosity in packer that makes it obvious to set associate_public_ip_address |
I think this issue is subtly deceptive. In reality, this value is not strictly a boolean. It has three distinct cases:
These correspond to what we see when launching an instance in the console:
However, calling the parameter "associate_public_ip_address" and making it with a boolean, we are forced to select only two of the three possible outcomes. The way packer is currently programmed (mentioned above by @toidi), item 2 has been dropped and the cases are modified slightly.
The fact of "subnetID being set" seems to be proxy for "we are in a non-default VPC", as the subnetID must be set for default VPCs (per the packer documentation). This has the added effect of not being able turn off public IP assignment if you're in a default VPC (which is how I came across this problem) as well as not being able to turn it on in your default VPC if the default subnet has been modified to not to assign public IPs (OP's problem) However, neither of the control pathways listed coincide with what AWS says that the parameter means, namely:
The last sentence informs us indirectly that the subnet will choose this for us if AssociatePublicIpAddress is not invoked on the network interface. I have modified packer (version There are two solutions I see:
Probably a more sensible default would 'true' in this case. Or,
|
I think I like option 2 -- it's more explicit and more flexible. I'm not sure when I can have someone work on it but PRs are welcome and I don't think this would be too complex an issue for a new community member to tackle. We'd want to honor the |
This issue has been automatically migrated to hashicorp/packer-plugin-amazon#18 because it looks like an issue with that plugin. If you believe this is not an issue with the plugin, please reply to hashicorp/packer-plugin-amazon#18. |
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. |
Packer v1.2.5
Builder type
amazon-ebs
Assuming default networking setup.
Steps to reproduce:
Auto-assign public IPv4 address
in its default subnetsvpc_id
andsubnet_id
in default values(unset)associate_public_ip
to trueMore information
associate_public_ip_address
: true
does not work here, because based on source code it only takes effect ifsubnet_id
(orvpc_id
) is specified.https://github.com/hashicorp/packer/blob/v1.2.5/builder/amazon/common/step_run_source_instance.go#L157-L167
associate_public_ip_address
must work for default VPC in spite of disabledAuto-assign public IPv4 address
.The text was updated successfully, but these errors were encountered: