-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
provider/aws: aws_spot_fleet_request
throws panic on missing subnet_id or availability_zone
#8217
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
or availability_zone Fixes #8000 There was a hard coded panic in the code!!! ``` panic( fmt.Sprintf( "Must set one of:\navailability_zone %#v\nsubnet_id: %#v", m["availability_zone"], m["subnet_id"]) ) ``` This was causing issues when we set neither an availability zone or a subnet id. This has been removed and is now handled with an error rather than a panic. This was what happened with the new test before the fix: ``` === RUN TestAccAWSSpotFleetRequest_brokenLaunchSpecification panic: Must set one of: availability_zone "" subnet_id: "" goroutine 129 [running]: panic(0x11377a0, 0xc8202abfc0) /opt/boxen/homebrew/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6 github.com/hashicorp/terraform/builtin/providers/aws.hashLaunchSpecification(0x11361a0, 0xc8202e07e0, 0xc800000001) /Users/stacko/Code/go/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_spot_fleet_request.go:953 +0x685 github.com/hashicorp/terraform/helper/schema.(*Set).hash(0xc82005ae00, 0x11361a0, 0xc8202e07e0, 0x0, 0x0) /Users/stacko/Code/go/src/github.com/hashicorp/terraform/helper/schema/set.go:180 +0x40 github.com/hashicorp/terraform/helper/schema.(*Set).add(0xc82005ae00, 0x11361a0, 0xc8202e07e0, 0xc820276900, 0x0, 0x0) ``` The test then ran fine after the fix: ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotFleetRequest_brokenLaunchSpecification' ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /terraform/vendor/) 2016/08/16 08:03:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotFleetRequest_brokenLaunchSpecification -timeout 120m === RUN TestAccAWSSpotFleetRequest_brokenLaunchSpecification --- PASS: TestAccAWSSpotFleetRequest_brokenLaunchSpecification (32.37s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 32.384s ``` Full test run looks as follows: ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotFleetRequest_' ✹ ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /terraform/vendor/) 2016/08/16 08:04:34 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotFleetRequest_ -timeout 120m === RUN TestAccAWSSpotFleetRequest_basic --- PASS: TestAccAWSSpotFleetRequest_basic (33.78s) === RUN TestAccAWSSpotFleetRequest_brokenLaunchSpecification --- PASS: TestAccAWSSpotFleetRequest_brokenLaunchSpecification (33.59s) === RUN TestAccAWSSpotFleetRequest_launchConfiguration --- PASS: TestAccAWSSpotFleetRequest_launchConfiguration (35.26s) === RUN TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName --- PASS: TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 102.648s ```
Nice fix! |
Ouch haha. LGTM |
kwilczynski
pushed a commit
to kwilczynski/terraform
that referenced
this pull request
Aug 18, 2016
…_id (hashicorp#8217) or availability_zone Fixes hashicorp#8000 There was a hard coded panic in the code!!! ``` panic( fmt.Sprintf( "Must set one of:\navailability_zone %#v\nsubnet_id: %#v", m["availability_zone"], m["subnet_id"]) ) ``` This was causing issues when we set neither an availability zone or a subnet id. This has been removed and is now handled with an error rather than a panic. This was what happened with the new test before the fix: ``` === RUN TestAccAWSSpotFleetRequest_brokenLaunchSpecification panic: Must set one of: availability_zone "" subnet_id: "" goroutine 129 [running]: panic(0x11377a0, 0xc8202abfc0) /opt/boxen/homebrew/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6 github.com/hashicorp/terraform/builtin/providers/aws.hashLaunchSpecification(0x11361a0, 0xc8202e07e0, 0xc800000001) /Users/stacko/Code/go/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_spot_fleet_request.go:953 +0x685 github.com/hashicorp/terraform/helper/schema.(*Set).hash(0xc82005ae00, 0x11361a0, 0xc8202e07e0, 0x0, 0x0) /Users/stacko/Code/go/src/github.com/hashicorp/terraform/helper/schema/set.go:180 +0x40 github.com/hashicorp/terraform/helper/schema.(*Set).add(0xc82005ae00, 0x11361a0, 0xc8202e07e0, 0xc820276900, 0x0, 0x0) ``` The test then ran fine after the fix: ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotFleetRequest_brokenLaunchSpecification' ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /terraform/vendor/) 2016/08/16 08:03:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotFleetRequest_brokenLaunchSpecification -timeout 120m === RUN TestAccAWSSpotFleetRequest_brokenLaunchSpecification --- PASS: TestAccAWSSpotFleetRequest_brokenLaunchSpecification (32.37s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 32.384s ``` Full test run looks as follows: ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotFleetRequest_' ✹ ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /terraform/vendor/) 2016/08/16 08:04:34 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotFleetRequest_ -timeout 120m === RUN TestAccAWSSpotFleetRequest_basic --- PASS: TestAccAWSSpotFleetRequest_basic (33.78s) === RUN TestAccAWSSpotFleetRequest_brokenLaunchSpecification --- PASS: TestAccAWSSpotFleetRequest_brokenLaunchSpecification (33.59s) === RUN TestAccAWSSpotFleetRequest_launchConfiguration --- PASS: TestAccAWSSpotFleetRequest_launchConfiguration (35.26s) === RUN TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName --- PASS: TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 102.648s ```
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8000
There was a hard coded panic in the code!!!
This was causing issues when we set neither an availability zone or a subnet id.
This has been removed and is now handled with an error rather than a panic.
This was what happened with the new test before the fix:
The test then ran fine after the fix:
Full test run looks as follows: