Skip to content

Commit 98bc929

Browse files
committed
adding codebuild, codecommit and git-codecommit vpc end point support
1 parent 7c4ddd6 commit 98bc929

File tree

4 files changed

+133
-1
lines changed

4 files changed

+133
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<a name="unreleased"></a>
22
## [Unreleased]
33
- Updated CHANGELOG
4-
- Added VPC endpoint for Secrets Manager, Config
4+
- Added VPC endpoint for Secrets Manager, Config, git-codecommit
55

66
<a name="v2.7.0"></a>
77
## [v2.7.0] - 2019-06-17

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,15 @@ Sometimes it is handy to have public access to Redshift clusters (for example if
368368
| sns\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SNS endpoint | bool | `"false"` | no |
369369
| sns\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SNS endpoint | list(string) | `[]` | no |
370370
| sns\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for SNS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list(string) | `[]` | no |
371+
| codebuild\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Codebuild endpoint | string | `"false"` | no |
372+
| codebuild\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Codebuild endpoint | list | `[]` | no |
373+
| codebuild\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Codebuild endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list | `[]` | no |
374+
| codecommit\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Codecommit endpoint | string | `"false"` | no |
375+
| codecommit\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Codecommit endpoint | list | `[]` | no |
376+
| codecommit\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Codecommit endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list | `[]` | no |
377+
| git\_codecommit\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Git Codecommit endpoint | string | `"false"` | no |
378+
| git\_codecommit\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Git Codecommit endpoint | list | `[]` | no |
379+
| git\_codecommit\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Git Codecommit endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list | `[]` | no |
371380
| config\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Config endpoint | string | `"false"` | no |
372381
| config\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Config endpoint | list | `[]` | no |
373382
| config\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Config endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list | `[]` | no |

main.tf

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,69 @@ resource "aws_vpc_endpoint_route_table_association" "public_dynamodb" {
899899
}
900900

901901

902+
#############################
903+
# VPC Endpoint for Codebuild
904+
#############################
905+
data "aws_vpc_endpoint_service" "codebuild" {
906+
count = var.create_vpc && var.enable_codebuild_endpoint ? 1 : 0
907+
908+
service = "codebuild"
909+
}
910+
911+
resource "aws_vpc_endpoint" "codebuild" {
912+
count = var.create_vpc && var.enable_codebuild_endpoint ? 1 : 0
913+
914+
vpc_id = local.vpc_id
915+
service_name = data.aws_vpc_endpoint_service.codebuild[0].service_name
916+
vpc_endpoint_type = "Interface"
917+
918+
security_group_ids = var.codebuild_endpoint_security_group_ids
919+
subnet_ids = coalescelist(var.codebuild_endpoint_subnet_ids, aws_subnet.private.*.id)
920+
private_dns_enabled = var.codebuild_endpoint_private_dns_enabled
921+
}
922+
923+
###############################
924+
# VPC Endpoint for Code Commit
925+
###############################
926+
data "aws_vpc_endpoint_service" "codecommit" {
927+
count = var.create_vpc && var.enable_codecommit_endpoint ? 1 : 0
928+
929+
service = "codecommit"
930+
}
931+
932+
resource "aws_vpc_endpoint" "codecommit" {
933+
count = var.create_vpc && var.enable_codecommit_endpoint ? 1 : 0
934+
935+
vpc_id = local.vpc_id
936+
service_name = data.aws_vpc_endpoint_service.codecommit[0].service_name
937+
vpc_endpoint_type = "Interface"
938+
939+
security_group_ids = var.codecommit_endpoint_security_group_ids
940+
subnet_ids = coalescelist(var.codecommit_endpoint_subnet_ids, aws_subnet.private.*.id)
941+
private_dns_enabled = var.codecommit_endpoint_private_dns_enabled
942+
}
943+
944+
###################################
945+
# VPC Endpoint for Git Code Commit
946+
###################################
947+
data "aws_vpc_endpoint_service" "git_codecommit" {
948+
count = var.create_vpc && var.enable_git_codecommit_endpoint ? 1 : 0
949+
950+
service = "git-codecommit"
951+
}
952+
953+
resource "aws_vpc_endpoint" "git_codecommit" {
954+
count = var.create_vpc && var.enable_git_codecommit_endpoint ? 1 : 0
955+
956+
vpc_id = local.vpc_id
957+
service_name = data.aws_vpc_endpoint_service.git_codecommit[0].service_name
958+
vpc_endpoint_type = "Interface"
959+
960+
security_group_ids = var.git_codecommit_endpoint_security_group_ids
961+
subnet_ids = coalescelist(var.git_codecommit_endpoint_subnet_ids, aws_subnet.private.*.id)
962+
private_dns_enabled = var.git_codecommit_endpoint_private_dns_enabled
963+
}
964+
902965
##########################
903966
# VPC Endpoint for Config
904967
##########################

variables.tf

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,66 @@ variable "enable_s3_endpoint" {
218218
default = false
219219
}
220220

221+
variable "enable_codebuild_endpoint" {
222+
description = "Should be true if you want to provision an Codebuild endpoint to the VPC"
223+
default = false
224+
}
225+
226+
variable "codebuild_endpoint_security_group_ids" {
227+
description = "The ID of one or more security groups to associate with the network interface for Codebuild endpoint"
228+
default = []
229+
}
230+
231+
variable "codebuild_endpoint_subnet_ids" {
232+
description = "The ID of one or more subnets in which to create a network interface for Codebuilt endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
233+
default = []
234+
}
235+
236+
variable "codebuild_endpoint_private_dns_enabled" {
237+
description = "Whether or not to associate a private hosted zone with the specified VPC for Codebuild endpoint"
238+
default = false
239+
}
240+
241+
variable "enable_codecommit_endpoint" {
242+
description = "Should be true if you want to provision an Codecommit endpoint to the VPC"
243+
default = false
244+
}
245+
246+
variable "codecommit_endpoint_security_group_ids" {
247+
description = "The ID of one or more security groups to associate with the network interface for Codecommit endpoint"
248+
default = []
249+
}
250+
251+
variable "codecommit_endpoint_subnet_ids" {
252+
description = "The ID of one or more subnets in which to create a network interface for Codecommit endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
253+
default = []
254+
}
255+
256+
variable "codecommit_endpoint_private_dns_enabled" {
257+
description = "Whether or not to associate a private hosted zone with the specified VPC for Codecommit endpoint"
258+
default = false
259+
}
260+
261+
variable "enable_git_codecommit_endpoint" {
262+
description = "Should be true if you want to provision an Git Codecommit endpoint to the VPC"
263+
default = false
264+
}
265+
266+
variable "git_codecommit_endpoint_security_group_ids" {
267+
description = "The ID of one or more security groups to associate with the network interface for Git Codecommit endpoint"
268+
default = []
269+
}
270+
271+
variable "git_codecommit_endpoint_subnet_ids" {
272+
description = "The ID of one or more subnets in which to create a network interface for Git Codecommit endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
273+
default = []
274+
}
275+
276+
variable "git_codecommit_endpoint_private_dns_enabled" {
277+
description = "Whether or not to associate a private hosted zone with the specified VPC for Git Codecommit endpoint"
278+
default = false
279+
}
280+
221281
variable "enable_config_endpoint" {
222282
description = "Should be true if you want to provision an config endpoint to the VPC"
223283
default = false

0 commit comments

Comments
 (0)