Skip to content

Commit

Permalink
r/aws_kms_grant: Remove extraneous Exists function.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit authored and appilon committed Apr 29, 2020
1 parent a4cd46d commit ce93d4a
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions aws/resource_aws_kms_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func resourceAwsKmsGrant() *schema.Resource {
Create: resourceAwsKmsGrantCreate,
Read: resourceAwsKmsGrantRead,
Delete: resourceAwsKmsGrantDelete,
Exists: resourceAwsKmsGrantExists,
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
keyId, grantId, err := decodeKmsGrantId(d.Id())
Expand Down Expand Up @@ -299,30 +298,6 @@ func resourceAwsKmsGrantDelete(d *schema.ResourceData, meta interface{}) error {
return err
}

func resourceAwsKmsGrantExists(d *schema.ResourceData, meta interface{}) (bool, error) {
conn := meta.(*AWSClient).kmsconn

keyId, grantId, err := decodeKmsGrantId(d.Id())
if err != nil {
return false, err
}

log.Printf("[DEBUG] Looking for Grant: %s", grantId)
grant, err := findKmsGrantByIdWithRetry(conn, keyId, grantId)

if err != nil {
if isResourceNotFoundError(err) {
return false, nil
}
return true, err
}
if grant != nil {
return true, err
}

return false, nil
}

func getKmsGrantById(grants []*kms.GrantListEntry, grantIdentifier string) *kms.GrantListEntry {
for _, grant := range grants {
if *grant.GrantId == grantIdentifier {
Expand Down

0 comments on commit ce93d4a

Please sign in to comment.