= templatefile( "./policy/assume_role_policy.tftpl", { service = [ "build.apprunner.amazonaws.com", "tasks.apprunner.amazonaws.com" ] } ) } resource "aws_iam_role_policy_attachment" "apprunner_service_role" { role = aws_iam_role.apprunner_service_role.name policy_arn = "arn:aws:iam::aws:policy/service-role/AWSAppRunnerServicePolicyForECRAccess" } { "Version": "2012-10-17", "Statement": [ { "Sid": "", "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": ${jsonencode(service)} } } ] } テンプレート テンプレート参照 AppRunner用のAWS管理ポリシーを適用