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 password data on spot requests #4189

Merged
merged 2 commits into from
Apr 12, 2018

Conversation

bodgit
Copy link
Contributor

@bodgit bodgit commented Apr 12, 2018

#2219 added support for retrieving the instance password data but this wasn't also added for spot requests so even though the same get_password_data attribute can be set (due to the spot request schema inheriting the instance schema), it doesn't work and returns an error if you try and read the password_data attribute.

This PR simply copies the same code from the original PR that read the password data and now works for me with a Windows spot request the same as a regular instance.

@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Apr 12, 2018
@bflad
Copy link
Contributor

bflad commented Apr 12, 2018

Can you please add an acceptance test to cover the behavior when its enabled (we just need to test the true scenario)? You can use TestAccAWSInstance_getPasswordData_trueToFalse and its testAccInstanceConfig_getPasswordData configuration as inspiration. Thanks!

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. waiting-response Maintainers are waiting on response from community or contributor. labels Apr 12, 2018
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Apr 12, 2018
@bodgit
Copy link
Contributor Author

bodgit commented Apr 12, 2018

If I back my original change out with this test present:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSSpotInstanceRequest_getPasswordData'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSSpotInstanceRequest_getPasswordData -timeout 120m
=== RUN   TestAccAWSSpotInstanceRequest_getPasswordData
--- FAIL: TestAccAWSSpotInstanceRequest_getPasswordData (106.26s)
        testing.go:518: Step 0 error: Check failed: Check 2/2 error: aws_spot_instance_request.foo: Attribute 'password_data' expected to be set
FAIL
exit status 1
FAIL    github.com/terraform-providers/terraform-provider-aws/aws       106.274s
make: *** [testacc] Error 1

And with my change back in:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSSpotInstanceRequest_getPasswordData'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSSpotInstanceRequest_getPasswordData -timeout 120m
=== RUN   TestAccAWSSpotInstanceRequest_getPasswordData
--- PASS: TestAccAWSSpotInstanceRequest_getPasswordData (280.86s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       280.875s

Ok?

@bodgit bodgit force-pushed the spot-password-data branch from f87c7a8 to 3cbbe2c Compare April 12, 2018 16:28
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Apr 12, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Great work @bodgit! 🚀

7 tests passed (all tests)
=== RUN   TestAccAWSSpotInstanceRequest_NetworkInterfaceAttributes
--- PASS: TestAccAWSSpotInstanceRequest_NetworkInterfaceAttributes (85.62s)
=== RUN   TestAccAWSSpotInstanceRequest_withBlockDuration
--- PASS: TestAccAWSSpotInstanceRequest_withBlockDuration (87.49s)
=== RUN   TestAccAWSSpotInstanceRequest_SubnetAndSGAndPublicIpAddress
--- PASS: TestAccAWSSpotInstanceRequest_SubnetAndSGAndPublicIpAddress (90.57s)
=== RUN   TestAccAWSSpotInstanceRequest_withLaunchGroup
--- PASS: TestAccAWSSpotInstanceRequest_withLaunchGroup (107.97s)
=== RUN   TestAccAWSSpotInstanceRequest_basic
--- PASS: TestAccAWSSpotInstanceRequest_basic (108.00s)
=== RUN   TestAccAWSSpotInstanceRequest_vpc
--- PASS: TestAccAWSSpotInstanceRequest_vpc (123.09s)
=== RUN   TestAccAWSSpotInstanceRequest_getPasswordData
--- PASS: TestAccAWSSpotInstanceRequest_getPasswordData (343.69s)

@bflad bflad merged commit 673afb2 into hashicorp:master Apr 12, 2018
@bflad bflad added this to the v1.15.0 milestone Apr 12, 2018
@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 12, 2018
bflad added a commit that referenced this pull request Apr 12, 2018
@bflad
Copy link
Contributor

bflad commented Apr 18, 2018

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

@ghost
Copy link

ghost commented Apr 6, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants