Skip to content

Commit

Permalink
Merge pull request #15688 from terraform-providers/t-gov-hardarn-iam
Browse files Browse the repository at this point in the history
tests/provider: Fix hardcoded ARN (IAM)
  • Loading branch information
YakDriver authored Oct 17, 2020
2 parents 5bcbfd0 + 2b16426 commit 303f6bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions aws/resource_aws_iam_service_linked_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion aws/resource_aws_iam_user_login_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}"]
}
}
Expand Down

0 comments on commit 303f6bf

Please sign in to comment.