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

r/spot_fleet_request - zero capacity update #12759

Merged

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Apr 10, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #12757
Closes #9322 (possibly, as now there is a wait for modification to complete i have encountered a similar issue when working on this)

Release note for CHANGELOG:

resource_aws_spot_fleet_request: allow updating capacity to zero
resource_aws_spot_fleet_request: wait for modification to complete

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSSpotFleetRequest_zero_capacity'
--- PASS: TestAccAWSSpotFleetRequest_zero_capacity (452.08s)

@DrFaust92 DrFaust92 requested a review from a team April 10, 2020 12:15
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/M Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 10, 2020
@ewbankkit
Copy link
Contributor

Verified acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSpotFleetRequest_zero_capacity'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSSpotFleetRequest_zero_capacity -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_zero_capacity
=== PAUSE TestAccAWSSpotFleetRequest_zero_capacity
=== CONT  TestAccAWSSpotFleetRequest_zero_capacity
--- PASS: TestAccAWSSpotFleetRequest_zero_capacity (341.44s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	341.483s

@DrFaust92 DrFaust92 changed the title r/spot_fleet_request - zero capacity update [WIP]r/spot_fleet_request - zero capacity update Apr 28, 2020
@DrFaust92 DrFaust92 force-pushed the r/spot_fleet_request_zero_capacity branch from e3cbc89 to afc6781 Compare April 28, 2020 20:54
@DrFaust92 DrFaust92 changed the title [WIP]r/spot_fleet_request - zero capacity update r/spot_fleet_request - zero capacity update Apr 28, 2020
@DrFaust92 DrFaust92 force-pushed the r/spot_fleet_request_zero_capacity branch from afc6781 to b9c0003 Compare May 1, 2020 12:27
@DrFaust92 DrFaust92 added the bug Addresses a defect in current functionality. label May 22, 2020
@DrFaust92 DrFaust92 removed the needs-triage Waiting for first response or review from a maintainer. label Jul 24, 2020
@ewbankkit ewbankkit requested review from ewbankkit and removed request for a team July 25, 2020 21:18
@ewbankkit
Copy link
Contributor

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSpotFleetRequest_zero_capacity'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSSpotFleetRequest_zero_capacity -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_zero_capacity
=== PAUSE TestAccAWSSpotFleetRequest_zero_capacity
=== CONT  TestAccAWSSpotFleetRequest_zero_capacity
panic: interface conversion: interface {} is nil, not string

goroutine 587 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.hashLaunchSpecification(0x59ad280, 0xc0014aa4b0, 0xc000000001)
	/home/kit/wrk/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_spot_fleet_request.go:1627 +0x6bf
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).hash(0xc000a25040, 0x59ad280, 0xc0014aa4b0, 0x434b2ac, 0x59ad280)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/set.go:221 +0x3d
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).add(0xc000a25040, 0x59ad280, 0xc0014aa4b0, 0xc000c8e000, 0x0, 0x0)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/set.go:198 +0x83
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Set).Add(...)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/set.go:75
github.com/terraform-providers/terraform-provider-aws/aws.launchSpecsToSet(0xc001c865f0, 0x1, 0x1, 0xc000470888, 0xc001701e20, 0x0, 0x0)
	/home/kit/wrk/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_spot_fleet_request.go:1275 +0x7b
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsSpotFleetRequestRead(0xc000839f80, 0x5ba81c0, 0xc000267900, 0x0, 0x0)
	/home/kit/wrk/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_spot_fleet_request.go:1192 +0x43f
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsSpotFleetRequestCreate(0xc000839f80, 0x5ba81c0, 0xc000267900, 0x2, 0xb11fca0)
	/home/kit/wrk/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_spot_fleet_request.go:1017 +0x1089
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc0007ce120, 0xc000ef66e0, 0xc000eece40, 0x5ba81c0, 0xc000267900, 0xc0010ae201, 0xc00105cf30, 0xc0010ae308)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/resource.go:310 +0x365
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000110b80, 0xc000b879c8, 0xc000ef66e0, 0xc000eece40, 0xc001041948, 0xc00133b0f0, 0x59ad280)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/provider.go:294 +0x99
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00133bc10, 0x75a0f00, 0xc000ef43c0, 0xc000839a40, 0xc00133bc10, 0xc000ef43c0, 0xc000a7fb30)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:885 +0x8b4
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x659fe40, 0xc00133bc10, 0x75a0f00, 0xc000ef43c0, 0xc000dbf7a0, 0x0, 0x75a0f00, 0xc000ef43c0, 0xc001028800, 0x79e)
	/home/kit/wrk/pkg/mod/github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3305 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000f78f00, 0x75cd860, 0xc000f79080, 0xc0001ea600, 0xc000f85680, 0xb0da8a0, 0x0, 0x0, 0x0)
	/home/kit/wrk/pkg/mod/google.golang.org/[email protected]/server.go:1024 +0x4f4
google.golang.org/grpc.(*Server).handleStream(0xc000f78f00, 0x75cd860, 0xc000f79080, 0xc0001ea600, 0x0)
	/home/kit/wrk/pkg/mod/google.golang.org/[email protected]/server.go:1313 +0xd97
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000ecabd0, 0xc000f78f00, 0x75cd860, 0xc000f79080, 0xc0001ea600)
	/home/kit/wrk/pkg/mod/google.golang.org/[email protected]/server.go:722 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/home/kit/wrk/pkg/mod/google.golang.org/[email protected]/server.go:720 +0xa1
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	64.768s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1

This happened in 2 regions I tested in.

@DrFaust92 DrFaust92 force-pushed the r/spot_fleet_request_zero_capacity branch from cabe97d to af893dc Compare July 28, 2020 07:18
@DrFaust92
Copy link
Collaborator Author

@ewbankkit. ill check it out but it seems unrelated to my change as its stemming from hashLaunchSpecification. can it be related to #13577 ? ill take a closer look

@ewbankkit
Copy link
Contributor

@DrFaust92 Yes it does look related; I'll retest now you have rebased.

@ewbankkit
Copy link
Contributor

Acceptance test passes now:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSpotFleetRequest_zero_capacity'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSpotFleetRequest_zero_capacity -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_zero_capacity
=== PAUSE TestAccAWSSpotFleetRequest_zero_capacity
=== CONT  TestAccAWSSpotFleetRequest_zero_capacity
--- PASS: TestAccAWSSpotFleetRequest_zero_capacity (384.21s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	384.261s

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

Just need to tweak the spot_price in the new acceptance test for Gov Cloud and then LGTM.
Depending on whether #13091 is merged first this may need a rebase and change for the updated testAccAWSSpotFleetRequestConfig().

@DrFaust92
Copy link
Collaborator Author

DrFaust92 commented Jul 28, 2020

Fixed spot price, cant run test validate on gov region

@ewbankkit
Copy link
Contributor

@DrFaust92 #13091 was just merged. Although no conflict is showing I think you will have to modify the call to testAccAWSSpotFleetRequestConfig() in your new acceptance test.
Could you please rebase and see if that is the case?
Thanks.

wait for modification to complete
@DrFaust92 DrFaust92 force-pushed the r/spot_fleet_request_zero_capacity branch from cfcd5c5 to 2f8223d Compare July 28, 2020 18:38
@DrFaust92
Copy link
Collaborator Author

rebased and tested

@ewbankkit
Copy link
Contributor

Re-verified in us-west-2:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSpotFleetRequest_zero_capacity'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSpotFleetRequest_zero_capacity -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_zero_capacity
=== PAUSE TestAccAWSSpotFleetRequest_zero_capacity
=== CONT  TestAccAWSSpotFleetRequest_zero_capacity
--- PASS: TestAccAWSSpotFleetRequest_zero_capacity (361.04s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	361.094s

@anGie44 anGie44 added this to the v3.1.0 milestone Jul 31, 2020
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Output of acceptance tests

--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_EbsBlockDevice_KmsKeyId (129.06s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_RootBlockDevice_KmsKeyId (123.21s)
--- PASS: TestAccAWSSpotFleetRequest_WithELBs (271.38s)
--- PASS: TestAccAWSSpotFleetRequest_WithTargetGroups (376.58s)
--- PASS: TestAccAWSSpotFleetRequest_associatePublicIpAddress (279.31s)
--- PASS: TestAccAWSSpotFleetRequest_basic (321.63s)
--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesNewRequest (614.12s)
--- PASS: TestAccAWSSpotFleetRequest_disappears (299.13s)
--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (371.23s)
--- PASS: TestAccAWSSpotFleetRequest_fleetType (265.24s)
--- PASS: TestAccAWSSpotFleetRequest_iamInstanceProfileArn (259.26s)
--- PASS: TestAccAWSSpotFleetRequest_instanceInterruptionBehavior (325.81s)
--- PASS: TestAccAWSSpotFleetRequest_launchSpecToLaunchTemplate (613.38s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate (246.76s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateToLaunchSpec (536.17s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateWithOverrides (258.66s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate_multiple (262.63s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList (240.74s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion (318.55s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList (243.11s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstancePools (361.09s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz (386.22s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet (250.26s)
--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (246.07s)
--- PASS: TestAccAWSSpotFleetRequest_placementTenancyAndGroup (55.53s)
--- PASS: TestAccAWSSpotFleetRequest_tags (326.41s)
--- PASS: TestAccAWSSpotFleetRequest_updateExcessCapacityTerminationPolicy (614.16s)
--- PASS: TestAccAWSSpotFleetRequest_updateTargetCapacity (882.94s)
--- PASS: TestAccAWSSpotFleetRequest_withEBSDisk (340.00s)
--- PASS: TestAccAWSSpotFleetRequest_withTags (330.18s)
--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (361.67s)
--- PASS: TestAccAWSSpotFleetRequest_withoutSpotPrice (290.71s)
--- PASS: TestAccAWSSpotFleetRequest_zero_capacity (339.53s)

@anGie44 anGie44 merged commit db5f1c7 into hashicorp:master Jul 31, 2020
anGie44 added a commit that referenced this pull request Jul 31, 2020
@ghost
Copy link

ghost commented Aug 7, 2020

This has been released in version 3.1.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 for triage. Thanks!

@DrFaust92 DrFaust92 deleted the r/spot_fleet_request_zero_capacity branch August 27, 2020 18:00
@ghost
Copy link

ghost commented Aug 31, 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 Aug 31, 2020
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/ec2 Issues and PRs that pertain to the ec2 service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
5 participants