Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iam-policy-documents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data "aws_iam_policy_document" "backend_assume_role_restricted" {

principals {
type = "AWS"
identifiers = "${length(each.value) > 0 ? each.value : list(data.aws_caller_identity.current.account_id)}"
identifiers = length(each.value) > 0 ? each.value : list(data.aws_caller_identity.current.account_id)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ resource "aws_iam_role" "backend_restricted" {

name = "${var.resource_prefix}-terraform-backend-${each.key}"
description = "Allows access to the ${each.key} workspace prefix"
assume_role_policy = data.aws_iam_policy_document.backend_assume_role_restricted["${each.key}"].json
assume_role_policy = data.aws_iam_policy_document.backend_assume_role_restricted[each.key].json
tags = var.tags
}

resource "aws_iam_role_policy" "backend_restricted" {
for_each = var.workspace_details

name = "${var.resource_prefix}-terraform-backend-${each.key}"
policy = data.aws_iam_policy_document.iam_role_policy_restricted["${each.key}"].json
policy = data.aws_iam_policy_document.iam_role_policy_restricted[each.key].json
role = "${var.resource_prefix}-terraform-backend-${each.key}"

depends_on = [aws_iam_role.backend_restricted]
Expand Down