Skip to content

Commit 03eded6

Browse files
committed
Fixed formatting after #213
1 parent 8fededb commit 03eded6

File tree

4 files changed

+101
-81
lines changed

4 files changed

+101
-81
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ These types of resources are supported:
1515
* [VPN Gateway](https://www.terraform.io/docs/providers/aws/r/vpn_gateway.html)
1616
* [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):
1717
* Gateway: S3, DynamoDB
18-
* Interface: EC2, SSM, EC2 Messages, SSM Messages
18+
* Interface: EC2, SSM, EC2 Messages, SSM Messages, ECR API, ECR DKR
1919
* [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)
2020
* [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)
2121
* [Redshift Subnet Group](https://www.terraform.io/docs/providers/aws/r/redshift_subnet_group.html)
@@ -216,6 +216,12 @@ Terraform version 0.10.3 or newer is required for this module to work.
216216
| ec2messages\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EC2MESSAGES endpoint | string | `"false"` | no |
217217
| ec2messages\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for EC2MESSAGES endpoint | list | `[]` | no |
218218
| ec2messages\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for EC2MESSAGES endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list | `[]` | no |
219+
| ecr\_api\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for ECR API endpoint | string | `"false"` | no |
220+
| ecr\_api\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for ECR API endpoint | list | `[]` | no |
221+
| ecr\_api\_endpoint\_subnet\_ids | 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. | list | `[]` | no |
222+
| ecr\_dkr\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for ECR DKR endpoint | string | `"false"` | no |
223+
| ecr\_dkr\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for ECR DKR endpoint | list | `[]` | no |
224+
| ecr\_dkr\_endpoint\_subnet\_ids | 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. | list | `[]` | no |
219225
| elasticache\_route\_table\_tags | Additional tags for the elasticache route tables | map | `{}` | no |
220226
| elasticache\_subnet\_suffix | Suffix to append to elasticache subnets name | string | `"elasticache"` | no |
221227
| elasticache\_subnet\_tags | Additional tags for the elasticache subnets | map | `{}` | no |
@@ -226,6 +232,8 @@ Terraform version 0.10.3 or newer is required for this module to work.
226232
| enable\_dynamodb\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | string | `"false"` | no |
227233
| enable\_ec2\_endpoint | Should be true if you want to provision an EC2 endpoint to the VPC | string | `"false"` | no |
228234
| enable\_ec2messages\_endpoint | Should be true if you want to provision an EC2MESSAGES endpoint to the VPC | string | `"false"` | no |
235+
| enable\_ecr\_api\_endpoint | Should be true if you want to provision an ecr api endpoint to the VPC | string | `"false"` | no |
236+
| enable\_ecr\_dkr\_endpoint | Should be true if you want to provision an ecr dkr endpoint to the VPC | string | `"false"` | no |
229237
| enable\_nat\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | string | `"false"` | no |
230238
| enable\_s3\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | string | `"false"` | no |
231239
| enable\_ssm\_endpoint | Should be true if you want to provision an SSM endpoint to the VPC | string | `"false"` | no |

examples/complete-vpc/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ module "vpc" {
6262
ec2messages_endpoint_private_dns_enabled = true
6363
ec2messages_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
6464

65+
# VPC Endpoint for ECR API
66+
enable_ecr_api_endpoint = true
67+
ecr_api_endpoint_private_dns_enabled = true
68+
ecr_api_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
69+
70+
# VPC Endpoint for ECR DKR
71+
enable_ecr_dkr_endpoint = true
72+
ecr_dkr_endpoint_private_dns_enabled = true
73+
ecr_dkr_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
74+
6575
tags = {
6676
Owner = "user"
6777
Environment = "staging"

main.tf

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -367,46 +367,6 @@ resource "aws_vpc_endpoint_route_table_association" "public_s3" {
367367
route_table_id = "${aws_route_table.public.id}"
368368
}
369369

370-
##########################
371-
# VPC Endpoint for ECR API
372-
##########################
373-
data "aws_vpc_endpoint_service" "ecr_api" {
374-
count = "${var.create_vpc && var.enable_ecr_api_endpoint ? 1 : 0}"
375-
376-
service = "ecr.api"
377-
}
378-
379-
resource "aws_vpc_endpoint" "ecr_api" {
380-
count = "${var.create_vpc && var.enable_ecr_api_endpoint ? 1 : 0}"
381-
382-
vpc_endpoint_type = "Interface"
383-
vpc_id = "${local.vpc_id}"
384-
security_group_ids = ["${var.ecr_api_endpoint_security_group_ids}"]
385-
subnet_ids = ["${coalescelist(var.ecr_api_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
386-
service_name = "${data.aws_vpc_endpoint_service.ecr_api.service_name}"
387-
private_dns_enabled = "${var.ecr_api_endpoint_private_dns_enabled}"
388-
}
389-
390-
##########################
391-
# VPC Endpoint for ECR DKR
392-
##########################
393-
data "aws_vpc_endpoint_service" "ecr_dkr" {
394-
count = "${var.create_vpc && var.enable_ecr_dkr_endpoint ? 1 : 0}"
395-
396-
service = "ecr.dkr"
397-
}
398-
399-
resource "aws_vpc_endpoint" "ecr_dkr" {
400-
count = "${var.create_vpc && var.enable_ecr_dkr_endpoint ? 1 : 0}"
401-
402-
vpc_endpoint_type = "Interface"
403-
vpc_id = "${local.vpc_id}"
404-
security_group_ids = ["${var.ecr_dkr_endpoint_security_group_ids}"]
405-
subnet_ids = ["${coalescelist(var.ecr_dkr_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
406-
service_name = "${data.aws_vpc_endpoint_service.ecr_dkr.service_name}"
407-
private_dns_enabled = "${var.ecr_dkr_endpoint_private_dns_enabled}"
408-
}
409-
410370
############################
411371
# VPC Endpoint for DynamoDB
412372
############################
@@ -528,6 +488,48 @@ resource "aws_vpc_endpoint" "ec2messages" {
528488
private_dns_enabled = "${var.ec2messages_endpoint_private_dns_enabled}"
529489
}
530490

491+
###########################
492+
# VPC Endpoint for ECR API
493+
###########################
494+
data "aws_vpc_endpoint_service" "ecr_api" {
495+
count = "${var.create_vpc && var.enable_ecr_api_endpoint ? 1 : 0}"
496+
497+
service = "ecr.api"
498+
}
499+
500+
resource "aws_vpc_endpoint" "ecr_api" {
501+
count = "${var.create_vpc && var.enable_ecr_api_endpoint ? 1 : 0}"
502+
503+
vpc_id = "${local.vpc_id}"
504+
service_name = "${data.aws_vpc_endpoint_service.ecr_api.service_name}"
505+
vpc_endpoint_type = "Interface"
506+
507+
security_group_ids = ["${var.ecr_api_endpoint_security_group_ids}"]
508+
subnet_ids = ["${coalescelist(var.ecr_api_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
509+
private_dns_enabled = "${var.ecr_api_endpoint_private_dns_enabled}"
510+
}
511+
512+
###########################
513+
# VPC Endpoint for ECR DKR
514+
###########################
515+
data "aws_vpc_endpoint_service" "ecr_dkr" {
516+
count = "${var.create_vpc && var.enable_ecr_dkr_endpoint ? 1 : 0}"
517+
518+
service = "ecr.dkr"
519+
}
520+
521+
resource "aws_vpc_endpoint" "ecr_dkr" {
522+
count = "${var.create_vpc && var.enable_ecr_dkr_endpoint ? 1 : 0}"
523+
524+
vpc_id = "${local.vpc_id}"
525+
service_name = "${data.aws_vpc_endpoint_service.ecr_dkr.service_name}"
526+
vpc_endpoint_type = "Interface"
527+
528+
security_group_ids = ["${var.ecr_dkr_endpoint_security_group_ids}"]
529+
subnet_ids = ["${coalescelist(var.ecr_dkr_endpoint_subnet_ids, aws_subnet.private.*.id)}"]
530+
private_dns_enabled = "${var.ecr_dkr_endpoint_private_dns_enabled}"
531+
}
532+
531533
##########################
532534
# Route table association
533535
##########################

variables.tf

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -178,46 +178,6 @@ variable "enable_s3_endpoint" {
178178
default = false
179179
}
180180

181-
variable "enable_ecr_api_endpoint" {
182-
description = "Should be true if you want to provision an ecr api endpoint to the VPC"
183-
default = false
184-
}
185-
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-
191-
variable "ecr_api_endpoint_private_dns_enabled" {
192-
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR API endpoint"
193-
default = false
194-
}
195-
196-
variable "ecr_api_endpoint_security_group_ids" {
197-
description = "The ID of one or more security groups to associate with the network interface for ECR API endpoint"
198-
default = []
199-
}
200-
201-
variable "enable_ecr_dkr_endpoint" {
202-
description = "Should be true if you want to provision an ecr dkr endpoint to the VPC"
203-
default = false
204-
}
205-
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-
211-
variable "ecr_dkr_endpoint_private_dns_enabled" {
212-
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR DKR endpoint"
213-
default = false
214-
}
215-
216-
variable "ecr_dkr_endpoint_security_group_ids" {
217-
description = "The ID of one or more security groups to associate with the network interface for ECR DKR endpoint"
218-
default = []
219-
}
220-
221181
variable "enable_ssm_endpoint" {
222182
description = "Should be true if you want to provision an SSM endpoint to the VPC"
223183
default = false
@@ -298,6 +258,46 @@ variable "ec2messages_endpoint_subnet_ids" {
298258
default = []
299259
}
300260

261+
variable "enable_ecr_api_endpoint" {
262+
description = "Should be true if you want to provision an ecr api endpoint to the VPC"
263+
default = false
264+
}
265+
266+
variable "ecr_api_endpoint_subnet_ids" {
267+
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."
268+
default = []
269+
}
270+
271+
variable "ecr_api_endpoint_private_dns_enabled" {
272+
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR API endpoint"
273+
default = false
274+
}
275+
276+
variable "ecr_api_endpoint_security_group_ids" {
277+
description = "The ID of one or more security groups to associate with the network interface for ECR API endpoint"
278+
default = []
279+
}
280+
281+
variable "enable_ecr_dkr_endpoint" {
282+
description = "Should be true if you want to provision an ecr dkr endpoint to the VPC"
283+
default = false
284+
}
285+
286+
variable "ecr_dkr_endpoint_subnet_ids" {
287+
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."
288+
default = []
289+
}
290+
291+
variable "ecr_dkr_endpoint_private_dns_enabled" {
292+
description = "Whether or not to associate a private hosted zone with the specified VPC for ECR DKR endpoint"
293+
default = false
294+
}
295+
296+
variable "ecr_dkr_endpoint_security_group_ids" {
297+
description = "The ID of one or more security groups to associate with the network interface for ECR DKR endpoint"
298+
default = []
299+
}
300+
301301
variable "map_public_ip_on_launch" {
302302
description = "Should be false if you do not want to auto-assign public IP on launch"
303303
default = true

0 commit comments

Comments
 (0)