-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
48 lines (35 loc) · 1.09 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
locals {
enabled = module.this.enabled
}
data "aws_region" "current" {}
module "vpc" {
source = "cloudposse/vpc/aws"
version = "2.0.0"
ipv4_primary_cidr_block = var.vpc_cidr_block
context = module.this.context
}
module "subnets" {
source = "cloudposse/dynamic-subnets/aws"
version = "2.1.0"
vpc_id = module.vpc.vpc_id
igw_id = [module.vpc.igw_id]
ipv4_cidr_block = var.subnets_ipv4_cidr_block
availability_zones = var.subnets_availability_zones
nat_gateway_enabled = var.subnets_nat_gateway_enabled
max_nats = var.subnets_max_nats
context = module.this.context
}
module "vpce_s3_label" {
source = "cloudposse/label/null"
version = "0.25.0"
context = module.this.context
attributes = ["vpce-s3"]
}
resource "aws_vpc_endpoint" "s3" {
count = var.s3_endpoint_enabled && local.enabled ? 1 : 0
vpc_id = module.vpc.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
vpc_endpoint_type = "Gateway"
route_table_ids = module.subnets.private_route_table_ids
tags = module.vpce_s3_label.tags
}