Skip to content

Commit 176a596

Browse files
author
Michiel Dhadamus
committed
Added subnet ids to ecr endpoints
1 parent 33e8809 commit 176a596

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ resource "aws_vpc_endpoint" "ecr_api" {
382382
vpc_endpoint_type = "Interface"
383383
vpc_id = "${local.vpc_id}"
384384
security_group_ids = ["${var.ecr_api_endpoint_security_group_ids}"]
385+
subnet_ids = ["${coalescelist(var.ecr_api_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
385386
service_name = "${data.aws_vpc_endpoint_service.ecr_api.service_name}"
386387
private_dns_enabled = "${var.ecr_api_endpoint_private_dns_enabled}"
387388
}
@@ -401,6 +402,7 @@ resource "aws_vpc_endpoint" "ecr_dkr" {
401402
vpc_endpoint_type = "Interface"
402403
vpc_id = "${local.vpc_id}"
403404
security_group_ids = ["${var.ecr_dkr_endpoint_security_group_ids}"]
405+
subnet_ids = ["${coalescelist(var.ecr_dkr_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
404406
service_name = "${data.aws_vpc_endpoint_service.ecr_dkr.service_name}"
405407
private_dns_enabled = "${var.ecr_dkr_endpoint_private_dns_enabled}"
406408
}

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ variable "enable_ecr_api_endpoint" {
183183
default = false
184184
}
185185

186+
variable "ecr_api_endpoint_subnet_ids" {
187+
description = "The ID of one or more subnets in which to create a network interface for ECR api endpoint. If omitted, private subnets will be used."
188+
default = []
189+
}
190+
186191
variable "ecr_api_endpoint_private_dns_enabled" {
187192
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR API endpoint"
188193
default = false
@@ -198,6 +203,11 @@ variable "enable_ecr_dkr_endpoint" {
198203
default = false
199204
}
200205

206+
variable "ecr_dkr_endpoint_subnet_ids" {
207+
description = "The ID of one or more subnets in which to create a network interface for ECR dkr endpoint. If omitted, private subnets will be used."
208+
default = []
209+
}
210+
201211
variable "ecr_dkr_endpoint_private_dns_enabled" {
202212
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR DKR endpoint"
203213
default = false

0 commit comments

Comments
 (0)