-
Notifications
You must be signed in to change notification settings - Fork 14
/
vpc.tf
85 lines (76 loc) · 2.26 KB
/
vpc.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/v2.55.0
#
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> v2.55.0"
name = var.vpc_name
cidr = var.vpc_cidr
azs = var.vpc_azs
private_subnets = var.vpc_private_cidrs
public_subnets = var.vpc_public_cidrs
database_subnets = var.vpc_database_cidrs
enable_nat_gateway = true
single_nat_gateway = false
one_nat_gateway_per_az = true
enable_dns_hostnames = true
enable_dns_support = true
create_igw = true
# propagate_intra_route_tables_vgw = true
# propagate_private_route_tables_vgw = true
# propagate_public_route_tables_vgw = true
# vpn_gateway_id = ""
# enable_flow_log = true
# flow_log_destination_type = "s3"
# flow_log_destination_arn = module.s3_bucket_vpc_flow_logs.this_s3_bucket_arn
# vpc_flow_log_tags = {
# Name = local.s3_bucket_name
# Terraform = "true"
# Environnment = var.env
# TerraformWorkspace = terraform.workspace
# }
tags = local.tags
}
# --- Flow Logs Configuration --
# locals {
# s3_bucket_name = "${var.vpc_name}-vpc-flow-logs-${var.region}"
# }
# module "s3_bucket_vpc_flow_logs" {
# source = "terraform-aws-modules/s3-bucket/aws"
# version = "~> 1.9"
# bucket = local.s3_bucket_name
# policy = data.aws_iam_policy_document.flow_log_s3.json
# force_destroy = true
# tags = {
# Name = local.s3_bucket_name
# Terraform = "true"
# Environnment = var.env
# TerraformWorkspace = terraform.workspace
# }
# }
# data "aws_iam_policy_document" "flow_log_s3" {
# statement {
# sid = "AWSLogDeliveryWrite"
# principals {
# type = "Service"
# identifiers = ["delivery.logs.amazonaws.com"]
# }
# effect = "Allow"
# actions = [
# "s3:PutObject",
# ]
# resources = ["arn:aws:s3:::${local.s3_bucket_name}/AWSLogs/*"]
# }
# statement {
# sid = "AWSLogDeliveryAclCheck"
# principals {
# type = "Service"
# identifiers = ["delivery.logs.amazonaws.com"]
# }
# effect = "Allow"
# actions = [
# "s3:GetBucketAcl",
# ]
# resources = ["arn:aws:s3:::${local.s3_bucket_name}"]
# }
# }