Skip to content

Commit

Permalink
iam/instance_profile: Slight logic change
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Mar 27, 2024
1 parent 9e17366 commit 1efd2da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/service/iam/instance_profile.go
Original file line number Diff line number Diff line change
@@ -189,11 +189,14 @@ func resourceInstanceProfileRead(ctx context.Context, d *schema.ResourceData, me
d.Set("name", instanceProfile.InstanceProfileName)
d.Set("name_prefix", create.NamePrefixFromName(aws.StringValue(instanceProfile.InstanceProfileName)))
d.Set("path", instanceProfile.Path)

if d.Get("role") != "" {
d.Set("role", nil)
}
if len(instanceProfile.Roles) > 0 {
d.Set("role", instanceProfile.Roles[0].RoleName) //there will only be 1 role returned
} else if d.Get("role") != "" {
d.Set("role", nil)
}

d.Set("unique_id", instanceProfile.InstanceProfileId)

setTagsOut(ctx, instanceProfile.Tags)

0 comments on commit 1efd2da

Please sign in to comment.