Skip to content

Commit f4660da

Browse files
Emerson Barrosebarros29
Emerson Barros
authored andcommitted
fix: change count for for_each into ram_principal_association resource and adjust the output related to this resource
1 parent 74890e0 commit f4660da

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ resource "aws_ram_resource_association" "this" {
161161
}
162162

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

166-
principal = var.ram_principals[count.index]
166+
principal = each.value
167167
resource_share_arn = aws_ram_resource_share.this[0].arn
168168
}
169169

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ output "ram_resource_share_id" {
9696

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

0 commit comments

Comments
 (0)