Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to create ECR api and dkr endpoints #213

Merged
merged 2 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,46 @@ resource "aws_vpc_endpoint_route_table_association" "public_s3" {
route_table_id = "${aws_route_table.public.id}"
}

##########################
# VPC Endpoint for ECR API
##########################
data "aws_vpc_endpoint_service" "ecr_api" {
count = "${var.create_vpc && var.enable_ecr_api_endpoint ? 1 : 0}"

service = "ecr.api"
}

resource "aws_vpc_endpoint" "ecr_api" {
count = "${var.create_vpc && var.enable_ecr_api_endpoint ? 1 : 0}"

vpc_endpoint_type = "Interface"
vpc_id = "${local.vpc_id}"
security_group_ids = ["${var.ecr_api_endpoint_security_group_ids}"]
subnet_ids = ["${coalescelist(var.ecr_api_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
service_name = "${data.aws_vpc_endpoint_service.ecr_api.service_name}"
private_dns_enabled = "${var.ecr_api_endpoint_private_dns_enabled}"
}

##########################
# VPC Endpoint for ECR DKR
##########################
data "aws_vpc_endpoint_service" "ecr_dkr" {
count = "${var.create_vpc && var.enable_ecr_dkr_endpoint ? 1 : 0}"

service = "ecr.dkr"
}

resource "aws_vpc_endpoint" "ecr_dkr" {
count = "${var.create_vpc && var.enable_ecr_dkr_endpoint ? 1 : 0}"

vpc_endpoint_type = "Interface"
vpc_id = "${local.vpc_id}"
security_group_ids = ["${var.ecr_dkr_endpoint_security_group_ids}"]
subnet_ids = ["${coalescelist(var.ecr_dkr_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
service_name = "${data.aws_vpc_endpoint_service.ecr_dkr.service_name}"
private_dns_enabled = "${var.ecr_dkr_endpoint_private_dns_enabled}"
}

############################
# VPC Endpoint for DynamoDB
############################
Expand Down
40 changes: 40 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,46 @@ variable "enable_s3_endpoint" {
default = false
}

variable "enable_ecr_api_endpoint" {
description = "Should be true if you want to provision an ecr api endpoint to the VPC"
default = false
}

variable "ecr_api_endpoint_subnet_ids" {
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."
default = []
}

variable "ecr_api_endpoint_private_dns_enabled" {
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR API endpoint"
default = false
}

variable "ecr_api_endpoint_security_group_ids" {
description = "The ID of one or more security groups to associate with the network interface for ECR API endpoint"
default = []
}

variable "enable_ecr_dkr_endpoint" {
description = "Should be true if you want to provision an ecr dkr endpoint to the VPC"
default = false
}

variable "ecr_dkr_endpoint_subnet_ids" {
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."
default = []
}

variable "ecr_dkr_endpoint_private_dns_enabled" {
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR DKR endpoint"
default = false
}

variable "ecr_dkr_endpoint_security_group_ids" {
description = "The ID of one or more security groups to associate with the network interface for ECR DKR endpoint"
default = []
}

variable "enable_ssm_endpoint" {
description = "Should be true if you want to provision an SSM endpoint to the VPC"
default = false
Expand Down