From 2b164264bee1166fda24a49eb963a91c3b53f8e7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 16 Oct 2020 14:43:23 -0400 Subject: [PATCH] tests/provider: Fix hardcoded ARN (IAM) --- aws/resource_aws_iam_service_linked_role_test.go | 8 ++++---- aws/resource_aws_iam_user_login_profile_test.go | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/aws/resource_aws_iam_service_linked_role_test.go b/aws/resource_aws_iam_service_linked_role_test.go index 535f197a9cc..14876494113 100644 --- a/aws/resource_aws_iam_service_linked_role_test.go +++ b/aws/resource_aws_iam_service_linked_role_test.go @@ -90,25 +90,25 @@ func TestDecodeIamServiceLinkedRoleID(t *testing.T) { ErrCount: 1, }, { - Input: "arn:aws:iam::123456789012:role/not-service-linked-role", + Input: "arn:aws:iam::123456789012:role/not-service-linked-role", //lintignore:AWSAT005 ErrCount: 1, }, { - Input: "arn:aws:iam::123456789012:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling", + Input: "arn:aws:iam::123456789012:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling", //lintignore:AWSAT005 ServiceName: "autoscaling.amazonaws.com", RoleName: "AWSServiceRoleForAutoScaling", CustomSuffix: "", ErrCount: 0, }, { - Input: "arn:aws:iam::123456789012:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling_custom-suffix", + Input: "arn:aws:iam::123456789012:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling_custom-suffix", //lintignore:AWSAT005 ServiceName: "autoscaling.amazonaws.com", RoleName: "AWSServiceRoleForAutoScaling_custom-suffix", CustomSuffix: "custom-suffix", ErrCount: 0, }, { - Input: "arn:aws:iam::123456789012:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable", + Input: "arn:aws:iam::123456789012:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable", //lintignore:AWSAT005 ServiceName: "dynamodb.application-autoscaling.amazonaws.com", RoleName: "AWSServiceRoleForApplicationAutoScaling_DynamoDBTable", CustomSuffix: "DynamoDBTable", diff --git a/aws/resource_aws_iam_user_login_profile_test.go b/aws/resource_aws_iam_user_login_profile_test.go index 3f9f2a441e4..5be759d3ef5 100644 --- a/aws/resource_aws_iam_user_login_profile_test.go +++ b/aws/resource_aws_iam_user_login_profile_test.go @@ -323,6 +323,8 @@ resource "aws_iam_user" "user" { data "aws_caller_identity" "current" {} +data "aws_partition" "current" {} + data "aws_iam_policy_document" "user" { statement { effect = "Allow" @@ -333,7 +335,7 @@ data "aws_iam_policy_document" "user" { statement { effect = "Allow" actions = ["iam:ChangePassword"] - resources = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/&{aws:username}"] + resources = ["arn:${data.aws_partition.current.partition}:iam::${data.aws_caller_identity.current.account_id}:user/&{aws:username}"] } }