Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provider/aws:
aws_spot_fleet_request
throws panic on missing subnet…
…_id (#8217) 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 ```
- Loading branch information