diff --git a/.cspell.json b/.cspell.json index 21f9c4ab..b071e186 100644 --- a/.cspell.json +++ b/.cspell.json @@ -55,6 +55,7 @@ "tfvars", "tmpfs", "tonumber", + "trimprefix", "trivy", "userns", "xanzy", diff --git a/main.tf b/main.tf index 601ef0e2..f6b9c9f1 100644 --- a/main.tf +++ b/main.tf @@ -615,14 +615,14 @@ data "aws_iam_policy_document" "ssm" { var.runner_gitlab.preregistered_runner_token_ssm_parameter_name, aws_ssm_parameter.runner_registration_token.name ] - ) : "arn:${data.aws_partition.current.partition}:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/${name}" + ) : "arn:${data.aws_partition.current.partition}:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/${trimprefix(name, "/")}" ] } statement { actions = ["ssm:PutParameter"] resources = [ - "arn:${data.aws_partition.current.partition}:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/${aws_ssm_parameter.runner_registration_token.name}" + "arn:${data.aws_partition.current.partition}:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/${trimprefix(aws_ssm_parameter.runner_registration_token.name, "/")}" ] } }