From 499b818679ac98357e51c544469dca292127f3b3 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 21 Feb 2020 08:03:09 -0500 Subject: [PATCH] resource/aws_iam_saml_provider: Fixes for tfproviderlint R002 (#12027) Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/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) ``` --- aws/resource_aws_iam_saml_provider.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_iam_saml_provider.go b/aws/resource_aws_iam_saml_provider.go index 2a869dcea6c..d114c881c00 100644 --- a/aws/resource_aws_iam_saml_provider.go +++ b/aws/resource_aws_iam_saml_provider.go @@ -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) } @@ -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 }