diff --git a/builtin/providers/aws/resource_aws_instance.go b/builtin/providers/aws/resource_aws_instance.go index f9f2a29d7..198a23c5b 100644 --- a/builtin/providers/aws/resource_aws_instance.go +++ b/builtin/providers/aws/resource_aws_instance.go @@ -1085,5 +1085,6 @@ func iamInstanceProfileArnToName(ip *ec2.IamInstanceProfile) string { if ip == nil || ip.Arn == nil { return "" } - return strings.Split(*ip.Arn, "/")[1] + parts := strings.Split(*ip.Arn, "/") + return parts[len(parts)-1] }