Skip to content

Commit 85bf05b

Browse files
Move RAM services association resources local to data.tf
1 parent ff0fb7a commit 85bf05b

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

data.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ locals {
4343
share_service_network = local.config_ram_share ? local.create_service_network && try(var.ram_share.share_service_network, true) : false
4444
# Default of var.ram_share.share_services - if not defined, all the created services will be included
4545
share_services = try(var.ram_share.share_services, keys(var.services))
46+
# Support RAM share of services managed by the module as well as external ones
47+
ram_services_association_resources = {
48+
for svc in local.share_services :
49+
svc => lookup(
50+
aws_vpclattice_service.lattice_service,
51+
svc,
52+
lookup(
53+
data.aws_vpclattice_service.lattice_service,
54+
svc,
55+
null
56+
)
57+
)
58+
}
4659
# Move var.ram_share.principals from list(string) to map(string)
4760
principals_map = { for index, principal in try(var.ram_share.principals, []) : index => principal }
4861
}

main.tf

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -274,21 +274,6 @@ resource "aws_ram_resource_association" "ram_service_network_association" {
274274
resource_share_arn = local.resource_share_arn
275275
}
276276

277-
locals {
278-
ram_services_association_resources = {
279-
for svc in local.share_services :
280-
svc => lookup(
281-
aws_vpclattice_service.lattice_service,
282-
svc,
283-
lookup(
284-
data.aws_vpclattice_service.lattice_service,
285-
svc,
286-
null
287-
)
288-
)
289-
}
290-
}
291-
292277
# AWS RAM resource association - VPC Lattice services
293278
resource "aws_ram_resource_association" "ram_services_association" {
294279
count = local.config_ram_share ? length(local.share_services) : 0

0 commit comments

Comments
 (0)