Skip to content

Commit af8b793

Browse files
committed
Use subnet ARNs instead of IDs when appropriate.
1 parent efd4766 commit af8b793

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

rift_compute/iam.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ resource "aws_iam_policy" "manage_rift_compute" {
2727
ALLOW_RUN_INSTANCES_RESOURCES = jsonencode(flatten([
2828
"arn:aws:ec2:*:${local.account_id}:volume/*",
2929
local.rift_security_group.arn,
30-
local.privatelink_subnet_ids,
30+
local.private_subnet_arns,
3131
])),
3232
ALLOW_NETWORK_INTERFACE_RESOURCES = jsonencode(flatten([
3333
local.rift_security_group.arn,
34-
local.privatelink_subnet_ids,
34+
local.private_subnet_arns,
3535
])),
3636
})
3737
}

rift_compute/vpc.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ locals {
55

66
# Used for the Tecton PrivateLink subnet associations.
77
# If existing VPC, use the provided list. Otherwise, use the created private subnets.
8-
privatelink_subnet_ids = local.is_existing_vpc ? var.existing_private_subnet_ids : values(aws_subnet.private)[*].id
8+
private_subnet_ids = local.is_existing_vpc ? var.existing_private_subnet_ids : values(aws_subnet.private)[*].id
9+
private_subnet_arns = local.is_existing_vpc ? [for subnet_id in var.existing_private_subnet_ids : format("arn:aws:ec2:%s:%s:subnet/%s", data.aws_region.current.name, data.aws_caller_identity.current.account_id, subnet_id)] : values(aws_subnet.private)[*].arn
910
rift_security_group = local.existing_security_group ? data.aws_security_group.existing[0] : aws_security_group.rift_compute[0]
1011

1112
vpc_cidr = var.vpc_cidr
@@ -198,10 +199,10 @@ resource "aws_vpc_endpoint" "tecton_privatelink" {
198199
}
199200

200201
resource "aws_vpc_endpoint_subnet_association" "tecton_privatelink" {
201-
count = var.tecton_vpce_service_name != null && length(local.privatelink_subnet_ids) > 0 ? length(local.privatelink_subnet_ids) : 0
202+
count = var.tecton_vpce_service_name != null && length(local.private_subnet_ids) > 0 ? length(local.private_subnet_ids) : 0
202203

203204
vpc_endpoint_id = aws_vpc_endpoint.tecton_privatelink[0].id
204-
subnet_id = local.privatelink_subnet_ids[count.index]
205+
subnet_id = local.private_subnet_ids[count.index]
205206
}
206207

207208

0 commit comments

Comments
 (0)