small update to keypair_refresh, to bring in-line with sdk changes

This commit is contained in:
Clint Shryock 2015-05-21 09:21:57 -05:00
parent 9e2ecafc46
commit 66372d8d1d
1 changed files with 3 additions and 2 deletions

View File

@ -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
}