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

Support explicit public ip on default vpc #364

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

lbajolet-hashicorp
Copy link
Contributor

This PR changes the way we set a VPC/Subnet during the StepNetworkInfo so that if the associate_public_ip_address attribute is set to true in the configs, it will be taken into account when setupping the network for the instance we are creating.

Closes #18

@lbajolet-hashicorp lbajolet-hashicorp requested a review from a team as a code owner April 17, 2023 20:13
@lbajolet-hashicorp lbajolet-hashicorp force-pushed the support_explicit_public_ip_on_default_vpc branch 3 times, most recently from 37c8fd6 to 682b403 Compare April 17, 2023 21:23
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Hey this is off to a good start. It covers the reported cases and passes as expected. I left a few comments about using SSM and sport instances. The tests take a bit of time to run.

I also left some thoughts on refactoring the code a little, as it was immediately clear to me what was happening. Let me know if you have any feedback or questions.

When implementing the AWS upload of public keys when one private key is
set in the configuration, we added one check to the Spot tests.
However, these do not define a private key, so the public key was never
uploaded, and the test would fail.
If a template requests a public IP for the instance being created, and
no VPC or subnet is, we get the default VPC ID and a random subnet in
this VPC to associate for the instance being created.

This fixes a bug where the public IP was requested, but because no
subnet was specified, it wasn't associated explicitely.
@lbajolet-hashicorp lbajolet-hashicorp force-pushed the support_explicit_public_ip_on_default_vpc branch from 682b403 to 7e6957b Compare April 18, 2023 18:08
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

LGTM

--- PASS: TestAccBuilder_SpotInstanceWithPublicIPAddressExplicitelySet (421.39s)
    --- PASS: TestAccBuilder_SpotInstanceWithPublicIPAddressExplicitelySet/Spot_instance,_with_public_IP_explicitely_set (89.36s)
    --- PASS: TestAccBuilder_SpotInstanceWithPublicIPAddressExplicitelySet/Spot_instance,_with_public_IP_explicitely_unset (113.94s)
    --- PASS: TestAccBuilder_SpotInstanceWithPublicIPAddressExplicitelySet/Non-Spot_instance,_with_public_IP_explicitely_set (97.49s)
    --- PASS: TestAccBuilder_SpotInstanceWithPublicIPAddressExplicitelySet/Non-Spot_instance,_with_public_IP_explicitely_unset (120.60s)
PASS

@nywilken nywilken added the bug label Apr 18, 2023
@lbajolet-hashicorp lbajolet-hashicorp merged commit f1ec287 into main Apr 18, 2023
@lbajolet-hashicorp lbajolet-hashicorp deleted the support_explicit_public_ip_on_default_vpc branch April 18, 2023 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amazon: Impossible to associate public IP in default subnet w/o auto-assign public IP
2 participants