Пытаюсь создать роль кросс-аккаунта, используя terraform, давая имя политики в качестве ошибки при получении ввода Ошибка: Ошибка при запросе ввода пользователя: невозможно проанализировать значение для переменной policy_arns
data "aws_iam_policy_document" "cross_account" {
statement {
effect = "Allow"
principals {
type = "AWS"
identifiers = ["${var.principal_arns}"]
}
actions = ["sts:AssumeRole"]
}
}
resource "aws_iam_role" "cross_account_role" {
name = "${var.name}"
assume_role_policy = "${data.aws_iam_policy_document.cross_account_assume_role_policy.json}"
}
resource "aws_iam_role_policy_attachment" "cross_account_role" {
count = "${length(var.policy_arns)}"
role = "${aws_iam_role.cross_account_role.name}"
policy_arn = "${element(var.policy_arns, count.index)}"
}
variable "name" {
type = "string"
description = "Name of the role being created."
}
variable "principal_arns" {
type = "list"
description = "ARNs of accounts, groups, or users with the ability to assume this role."
}
variable "policy_arns" {
type = "list"
description = "List of ARNs of policies to be associated with the created IAM role"
}