Skip to content

Commit

Permalink
fix: change count for for_each into ram_principal_association resourc…
Browse files Browse the repository at this point in the history
…e and adjust the output related to this resource
  • Loading branch information
Emerson Barros committed Dec 23, 2022
1 parent c155730 commit e56038e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ resource "aws_ram_resource_association" "this" {
}

resource "aws_ram_principal_association" "this" {
count = var.create_tgw && var.share_tgw ? length(var.ram_principals) : 0
for_each = var.create_tgw && var.share_tgw ? toset(var.ram_principals) : []

principal = var.ram_principals[count.index]
principal = each.value
resource_share_arn = aws_ram_resource_share.this[0].arn
}

Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ output "ram_resource_share_id" {

output "ram_principal_association_id" {
description = "The Amazon Resource Name (ARN) of the Resource Share and the principal, separated by a comma"
value = try(aws_ram_principal_association.this[0].id, "")
value = [for k, v in aws_ram_principal_association.this : v.id]
}

0 comments on commit e56038e

Please sign in to comment.