From 66372d8d1dd0e6c12898159fa15556bf28a93750 Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Thu, 21 May 2015 09:21:57 -0500 Subject: [PATCH] small update to keypair_refresh, to bring in-line with sdk changes --- builtin/providers/aws/resource_aws_key_pair.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_key_pair.go b/builtin/providers/aws/resource_aws_key_pair.go index cf4d82c54..036c35fe8 100644 --- a/builtin/providers/aws/resource_aws_key_pair.go +++ b/builtin/providers/aws/resource_aws_key_pair.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/terraform/helper/schema" "github.com/awslabs/aws-sdk-go/aws" + "github.com/awslabs/aws-sdk-go/aws/awserr" "github.com/awslabs/aws-sdk-go/service/ec2" ) @@ -65,8 +66,8 @@ func resourceAwsKeyPairRead(d *schema.ResourceData, meta interface{}) error { } resp, err := conn.DescribeKeyPairs(req) if err != nil { - awsErr, ok := err.(aws.APIError) - if ok && awsErr.Code == "InvalidKeyPair.NotFound" { + awsErr, ok := err.(awserr.Error) + if ok && awsErr.Code() == "InvalidKeyPair.NotFound" { d.SetId("") return nil }