From a1a65a1b953e5c809bf1791e0696dc0f1761a80b Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 19 Mar 2020 04:49:08 -0400 Subject: [PATCH] resource/aws_iam_instance_profile: Remove deprecated (helper/schema.ResourceData).Partial() and (helper/schema.ResourceData).SetPartial() Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/12083 Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/12087 Previously: ``` aws/resource_aws_iam_instance_profile.go:200:2: R007: deprecated (schema.ResourceData).Partial aws/resource_aws_iam_instance_profile.go:209:3: R008: deprecated (schema.ResourceData).SetPartial aws/resource_aws_iam_instance_profile.go:219:3: R008: deprecated (schema.ResourceData).SetPartial aws/resource_aws_iam_instance_profile.go:222:2: R007: deprecated (schema.ResourceData).Partial aws/resource_aws_iam_instance_profile.go:249:2: R007: deprecated (schema.ResourceData).Partial aws/resource_aws_iam_instance_profile.go:268:3: R008: deprecated (schema.ResourceData).SetPartial aws/resource_aws_iam_instance_profile.go:275:2: R007: deprecated (schema.ResourceData).Partial ``` Output from acceptance testing: ``` --- PASS: TestAccAWSIAMInstanceProfile_withoutRole (13.88s) --- PASS: TestAccAWSIAMInstanceProfile_basic (14.58s) --- PASS: TestAccAWSIAMInstanceProfile_withRoleNotRoles (14.64s) --- PASS: TestAccAWSIAMInstanceProfile_namePrefix (14.70s) ``` --- aws/resource_aws_iam_instance_profile.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/aws/resource_aws_iam_instance_profile.go b/aws/resource_aws_iam_instance_profile.go index 1dbd2ebe371..af183db58f4 100644 --- a/aws/resource_aws_iam_instance_profile.go +++ b/aws/resource_aws_iam_instance_profile.go @@ -197,8 +197,6 @@ func instanceProfileSetRoles(d *schema.ResourceData, iamconn *iam.IAM) error { currentRoles := schema.CopySet(oldRoles) - d.Partial(true) - for _, role := range oldRoles.Difference(newRoles).List() { err := instanceProfileRemoveRole(iamconn, d.Id(), role.(string)) if err != nil { @@ -206,7 +204,6 @@ func instanceProfileSetRoles(d *schema.ResourceData, iamconn *iam.IAM) error { } currentRoles.Remove(role) d.Set("roles", currentRoles) - d.SetPartial("roles") } for _, role := range newRoles.Difference(oldRoles).List() { @@ -216,11 +213,8 @@ func instanceProfileSetRoles(d *schema.ResourceData, iamconn *iam.IAM) error { } currentRoles.Add(role) d.Set("roles", currentRoles) - d.SetPartial("roles") } - d.Partial(false) - return nil } @@ -246,8 +240,6 @@ func instanceProfileRemoveAllRoles(d *schema.ResourceData, iamconn *iam.IAM) err func resourceAwsIamInstanceProfileUpdate(d *schema.ResourceData, meta interface{}) error { iamconn := meta.(*AWSClient).iamconn - d.Partial(true) - if d.HasChange("role") { oldRole, newRole := d.GetChange("role") @@ -264,16 +256,12 @@ func resourceAwsIamInstanceProfileUpdate(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error adding role %s to IAM instance profile %s: %s", newRole.(string), d.Id(), err) } } - - d.SetPartial("role") } if d.HasChange("roles") { return instanceProfileSetRoles(d, iamconn) } - d.Partial(false) - return nil }