Skip to content

Commit

Permalink
resource/aws_iam_saml_provider: Fixes for tfproviderlint R002
Browse files Browse the repository at this point in the history
Reference: #9952

Remove pointer value dereferences, which can cause potential panics and are extraneous as `Set()` automatically handles pointer types including when `nil`.

Previously:

```
aws/resource_aws_iam_saml_provider.go:91:34: R002: ResourceData.Set() pointer value dereference is extraneous
```

Output from acceptance testing:

```
--- PASS: TestAccAWSIAMSamlProvider_basic (22.26s)
```
  • Loading branch information
bflad committed Feb 13, 2020
1 parent 0efdad0 commit a49b68c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aws/resource_aws_iam_saml_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func resourceAwsIamSamlProviderCreate(d *schema.ResourceData, meta interface{})
return err
}

d.SetId(*out.SAMLProviderArn)
d.SetId(aws.StringValue(out.SAMLProviderArn))

return resourceAwsIamSamlProviderRead(d, meta)
}
Expand All @@ -80,15 +80,14 @@ func resourceAwsIamSamlProviderRead(d *schema.ResourceData, meta interface{}) er
return err
}

validUntil := out.ValidUntil.Format(time.RFC1123)
d.Set("arn", d.Id())
name, err := extractNameFromIAMSamlProviderArn(d.Id(), meta.(*AWSClient).partition)
if err != nil {
return err
}
d.Set("name", name)
d.Set("valid_until", validUntil)
d.Set("saml_metadata_document", *out.SAMLMetadataDocument)
d.Set("valid_until", out.ValidUntil.Format(time.RFC1123))
d.Set("saml_metadata_document", out.SAMLMetadataDocument)

return nil
}
Expand Down

0 comments on commit a49b68c

Please sign in to comment.