Merge pull request #4127 from hashicorp/aws-vet
Small updates to AWS provider to make go vet happy
This commit is contained in:
commit
501a016692
|
@ -36,7 +36,6 @@ func testAccCheckLifecycleHookExists(n string, hook *autoscaling.LifecycleHook)
|
|||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
if !ok {
|
||||
rs = rs
|
||||
return fmt.Errorf("Not found: %s", n)
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ func testAccCheckASGNDestroy(s *terraform.State) error {
|
|||
}
|
||||
|
||||
if len(resp.NotificationConfigurations) != 0 {
|
||||
fmt.Errorf("Error finding notification descriptions")
|
||||
return fmt.Errorf("Error finding notification descriptions")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ func testAccCheckScalingPolicyExists(n string, policy *autoscaling.ScalingPolicy
|
|||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
if !ok {
|
||||
rs = rs
|
||||
return fmt.Errorf("Not found: %s", n)
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ func testAccCheckCloudFormationStackExists(n string, stack *cloudformation.Stack
|
|||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
if !ok {
|
||||
rs = rs
|
||||
return fmt.Errorf("Not found: %s", n)
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ func resourceAwsInstanceMigrateState(
|
|||
default:
|
||||
return is, fmt.Errorf("Unexpected schema version: %d", v)
|
||||
}
|
||||
|
||||
return is, nil
|
||||
}
|
||||
|
||||
func migrateStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) {
|
||||
|
|
|
@ -112,22 +112,22 @@ func TestAccAWSInstance_blockDevices(t *testing.T) {
|
|||
|
||||
// Check if the root block device exists.
|
||||
if _, ok := blockDevices["/dev/sda1"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sda1")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sda1")
|
||||
}
|
||||
|
||||
// Check if the secondary block device exists.
|
||||
if _, ok := blockDevices["/dev/sdb"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sdb")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sdb")
|
||||
}
|
||||
|
||||
// Check if the third block device exists.
|
||||
if _, ok := blockDevices["/dev/sdc"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sdc")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sdc")
|
||||
}
|
||||
|
||||
// Check if the encrypted block device exists
|
||||
if _, ok := blockDevices["/dev/sdd"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sdd")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sdd")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -17,8 +17,6 @@ func resourceAwsKeyPairMigrateState(
|
|||
default:
|
||||
return is, fmt.Errorf("Unexpected schema version: %d", v)
|
||||
}
|
||||
|
||||
return is, nil
|
||||
}
|
||||
|
||||
func migrateKeyPairStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) {
|
||||
|
|
|
@ -162,17 +162,17 @@ func testAccCheckAWSLaunchConfigurationAttributes(conf *autoscaling.LaunchConfig
|
|||
|
||||
// Check if the root block device exists.
|
||||
if _, ok := blockDevices["/dev/sda1"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sda1")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sda1")
|
||||
}
|
||||
|
||||
// Check if the secondary block device exists.
|
||||
if _, ok := blockDevices["/dev/sdb"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sdb")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sdb")
|
||||
}
|
||||
|
||||
// Check if the third block device exists.
|
||||
if _, ok := blockDevices["/dev/sdc"]; !ok {
|
||||
fmt.Errorf("block device doesn't exist: /dev/sdc")
|
||||
return fmt.Errorf("block device doesn't exist: /dev/sdc")
|
||||
}
|
||||
|
||||
// Check if the secondary block device exists.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
|
@ -10,6 +11,11 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/schema"
|
||||
)
|
||||
|
||||
// How long to sleep if a limit-exceeded event happens
|
||||
var routeTargetValidationError = errors.New("Error: more than 1 target specified. Only 1 of gateway_id" +
|
||||
"instance_id, network_interface_id, route_table_id or" +
|
||||
"vpc_peering_connection_id is allowed.")
|
||||
|
||||
// AWS Route resource Schema declaration
|
||||
func resourceAwsRoute() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
|
@ -94,9 +100,7 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error {
|
|||
}
|
||||
|
||||
if numTargets > 1 {
|
||||
fmt.Errorf("Error: more than 1 target specified. Only 1 of gateway_id" +
|
||||
"instance_id, network_interface_id, route_table_id or" +
|
||||
"vpc_peering_connection_id is allowed.")
|
||||
return routeTargetValidationError
|
||||
}
|
||||
|
||||
createOpts := &ec2.CreateRouteInput{}
|
||||
|
@ -127,7 +131,7 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error {
|
|||
VpcPeeringConnectionId: aws.String(d.Get("vpc_peering_connection_id").(string)),
|
||||
}
|
||||
default:
|
||||
fmt.Errorf("Error: invalid target type specified.")
|
||||
return fmt.Errorf("Error: invalid target type specified.")
|
||||
}
|
||||
log.Printf("[DEBUG] Route create config: %s", createOpts)
|
||||
|
||||
|
@ -139,7 +143,7 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error {
|
|||
|
||||
route, err := findResourceRoute(conn, d.Get("route_table_id").(string), d.Get("destination_cidr_block").(string))
|
||||
if err != nil {
|
||||
fmt.Errorf("Error: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetId(routeIDHash(d, route))
|
||||
|
@ -187,9 +191,7 @@ func resourceAwsRouteUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
}
|
||||
|
||||
if numTargets > 1 {
|
||||
fmt.Errorf("Error: more than 1 target specified. Only 1 of gateway_id" +
|
||||
"instance_id, network_interface_id, route_table_id or" +
|
||||
"vpc_peering_connection_id is allowed.")
|
||||
return routeTargetValidationError
|
||||
}
|
||||
|
||||
// Formulate ReplaceRouteInput based on the target type
|
||||
|
@ -221,7 +223,7 @@ func resourceAwsRouteUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
VpcPeeringConnectionId: aws.String(d.Get("vpc_peering_connection_id").(string)),
|
||||
}
|
||||
default:
|
||||
fmt.Errorf("Error: invalid target type specified.")
|
||||
return fmt.Errorf("Error: invalid target type specified.")
|
||||
}
|
||||
log.Printf("[DEBUG] Route replace config: %s", replaceOpts)
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ func resourceAwsSecurityGroupRuleMigrateState(
|
|||
default:
|
||||
return is, fmt.Errorf("Unexpected schema version: %d", v)
|
||||
}
|
||||
|
||||
return is, nil
|
||||
}
|
||||
|
||||
func migrateSGRuleStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) {
|
||||
|
|
|
@ -223,8 +223,6 @@ func resourceAwsVpcDhcpOptionsDelete(d *schema.ResourceData, meta interface{}) e
|
|||
// Any other error, we want to quit the retry loop immediately
|
||||
return resource.RetryError{Err: err}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue