-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.tf
656 lines (566 loc) · 19.7 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
# Create VPC
resource "aws_vpc" "vpc" {
# checkov:skip=CKV2_AWS_12: All traffic restricted from within the security group
# checkov:skip=CKV2_AWS_1: Separate NACLs will be create per subnet group
cidr_block = var.cidr_block
enable_dns_support = var.enable_dns_support
enable_dns_hostnames = var.enable_dns_hostnames
instance_tenancy = var.instance_tenancy
assign_generated_ipv6_cidr_block = var.assign_ipv6_cidr_block
tags = merge({
Name = var.network_name
}, var.tags)
}
resource "aws_default_network_acl" "this" {
default_network_acl_id = aws_vpc.vpc.default_network_acl_id
tags = var.tags
}
locals {
vpc_mask = element(split("/", var.cidr_block), 1)
}
# Create public subnet
resource "aws_subnet" "pub_sub" {
# checkov:skip=CKV_AWS_130: Public IP required for resources in public subnet
count = length(var.azs)
vpc_id = aws_vpc.vpc.id
map_public_ip_on_launch = var.map_public_ip_for_public_subnet
cidr_block = cidrsubnet(
var.cidr_block,
var.pub_subnet_mask - local.vpc_mask,
count.index,
)
availability_zone = element(var.azs, count.index)
tags = merge({
Name = "${var.network_name}-pub-sub-${element(var.azs, count.index)}"
Tier = "public"
}, var.tags, var.add_eks_tags ? { "kubernetes.io/role/elb" : "1" } : {})
}
# Create private subnet
resource "aws_subnet" "pvt_sub" {
count = length(var.azs)
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(
var.cidr_block,
var.pvt_subnet_mask - local.vpc_mask,
count.index + length(var.azs),
)
availability_zone = element(var.azs, count.index)
tags = merge({
Name = "${var.network_name}-pvt-sub-${element(var.azs, count.index)}"
Tier = "private"
}, var.tags, var.add_eks_tags ? { "kubernetes.io/role/internal-elb" : "1" } : {})
}
# Create data subnet
resource "aws_subnet" "data_sub" {
count = length(var.azs)
vpc_id = aws_vpc.vpc.id
cidr_block = cidrsubnet(
var.cidr_block,
var.data_subnet_mask - local.vpc_mask,
count.index + length(var.azs) * 2,
)
availability_zone = element(var.azs, count.index)
tags = merge({
Name = "${var.network_name}-data-sub-${element(var.azs, count.index)}"
Tier = "private"
}, var.tags)
}
# Create internet gateway
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.vpc.id
tags = merge({
Name = "${var.network_name}-igw"
}, var.tags)
}
# Create public route table
resource "aws_route_table" "pub_rtb" {
vpc_id = aws_vpc.vpc.id
tags = merge({
Name = "${var.network_name}-pub-rtb"
}, var.tags)
}
resource "aws_route" "pub_rtb" {
route_table_id = aws_route_table.pub_rtb.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.igw.id
}
resource "aws_route_table_association" "pub_rtb_assoc" {
count = length(var.azs)
subnet_id = aws_subnet.pub_sub[count.index].id
route_table_id = aws_route_table.pub_rtb.id
}
# Create EIP for private NAT gateway
resource "aws_eip" "nat_eip" {
# checkov:skip=CKV2_AWS_19: EIP associated to NAT Gateway
count = var.create_pvt_nat && length(var.pvt_nat_eip_id) == 0 ? (var.pvt_nat_ha_mode ? length(var.azs) : 1) : 0
vpc = true
tags = merge({
Name = "${var.network_name}-pvt-nat-eip"
}, var.tags)
}
# Create NAT gateway for private subnet
resource "aws_nat_gateway" "nat_gw" {
count = var.create_pvt_nat ? (var.pvt_nat_ha_mode ? length(var.azs) : 1) : 0
subnet_id = aws_subnet.pub_sub[count.index].id
allocation_id = length(var.pvt_nat_eip_id) == 0 ? aws_eip.nat_eip[count.index].id : var.pvt_nat_eip_id[count.index]
tags = merge({
Name = "${var.network_name}-pvt-nat-gw"
}, var.tags)
}
# Create private route table
resource "aws_route_table" "pvt_rtb" {
count = var.create_pvt_nat == false ? 1 : 0
vpc_id = aws_vpc.vpc.id
tags = merge({
Name = "${var.network_name}-pvt-rtb"
}, var.tags)
}
resource "aws_route_table" "pvt_nat_rtb" {
count = var.create_pvt_nat ? (var.pvt_nat_ha_mode ? length(var.azs) : 1) : 0
vpc_id = aws_vpc.vpc.id
tags = merge({
Name = "${var.network_name}-pvt-rtb"
}, var.tags)
}
resource "aws_route" "pvt_nat_rtb" {
count = var.create_pvt_nat ? (var.pvt_nat_ha_mode ? length(var.azs) : 1) : 0
route_table_id = aws_route_table.pvt_nat_rtb[count.index].id
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gw[count.index].id
}
resource "aws_route_table_association" "pvt_rtb_assoc" {
count = length(var.azs)
subnet_id = aws_subnet.pvt_sub[count.index].id
route_table_id = var.create_pvt_nat ? (var.pvt_nat_ha_mode ? aws_route_table.pvt_nat_rtb[count.index].id : join(", ", aws_route_table.pvt_nat_rtb.*.id)) : join(", ", aws_route_table.pvt_rtb.*.id)
}
# Create EIP for data NAT gateway
resource "aws_eip" "data_nat_eip" {
# checkov:skip=CKV2_AWS_19: EIP associated to NAT Gateway
count = var.create_data_nat && length(var.data_nat_eip_id) == 0 ? (var.data_nat_ha_mode ? length(var.azs) : 1) : 0
vpc = true
tags = merge({
Name = "${var.network_name}-data-nat-eip"
}, var.tags)
}
# Create NAT gateway for data subnet
resource "aws_nat_gateway" "data_nat_gw" {
count = var.create_data_nat ? (var.data_nat_ha_mode ? length(var.azs) : 1) : 0
subnet_id = aws_subnet.pub_sub[count.index].id
allocation_id = length(var.data_nat_eip_id) == 0 ? aws_eip.data_nat_eip[count.index].id : var.data_nat_eip_id[count.index]
tags = merge({
Name = "${var.network_name}-data-nat-gw"
}, var.tags)
}
# Create data route table
resource "aws_route_table" "data_rtb" {
count = var.create_data_nat == false ? 1 : 0
vpc_id = aws_vpc.vpc.id
tags = merge({
Name = "${var.network_name}-data-rtb"
}, var.tags)
}
resource "aws_route_table" "data_nat_rtb" {
count = var.create_data_nat ? (var.data_nat_ha_mode ? length(var.azs) : 1) : 0
vpc_id = aws_vpc.vpc.id
tags = merge({
Name = "${var.network_name}-data-rtb"
}, var.tags)
}
resource "aws_route" "data_nat_rtb" {
count = var.create_data_nat ? (var.data_nat_ha_mode ? length(var.azs) : 1) : 0
route_table_id = aws_route_table.data_nat_rtb[count.index].id
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.data_nat_gw[count.index].id
}
resource "aws_route_table_association" "data_rtb_assoc" {
count = length(var.azs)
subnet_id = aws_subnet.data_sub[count.index].id
route_table_id = var.create_data_nat ? (var.data_nat_ha_mode ? aws_route_table.data_nat_rtb[count.index].id : join(", ", aws_route_table.data_nat_rtb.*.id)) : join(", ", aws_route_table.data_rtb.*.id)
}
# Create public NACL
resource "aws_network_acl" "pub_nacl" {
vpc_id = aws_vpc.vpc.id
subnet_ids = aws_subnet.pub_sub.*.id
ingress = var.pub_nacl_ingress
egress = var.pub_nacl_egress
tags = merge({
Name = "${var.network_name}-pub-nacl"
}, var.tags)
}
# Create private NACL
resource "aws_network_acl" "pvt_nacl" {
vpc_id = aws_vpc.vpc.id
subnet_ids = aws_subnet.pvt_sub.*.id
ingress = var.pvt_nacl_ingress
egress = var.pvt_nacl_egress
tags = merge({
Name = "${var.network_name}-pvt-nacl"
}, var.tags)
}
# Create data NACL
resource "aws_network_acl" "data_nacl" {
vpc_id = aws_vpc.vpc.id
subnet_ids = aws_subnet.data_sub.*.id
ingress = var.data_nacl_ingress
egress = var.data_nacl_egress
tags = merge({
Name = "${var.network_name}-data-nacl"
}, var.tags)
}
# Restrict default security group to deny all traffic
resource "aws_default_security_group" "default" {
# checkov:skip=CKV2_AWS_5: Attaching this security group to a resource depends on user
vpc_id = aws_vpc.vpc.id
tags = var.tags
}
# Create private security group
resource "aws_security_group" "pvt_sg" {
# checkov:skip=CKV2_AWS_5: Attaching this security group to a resource depends on user
# checkov:skip=CKV_AWS_23: Rule description not required
count = var.create_sgs ? 1 : 0
vpc_id = aws_vpc.vpc.id
name = "${var.network_name}-private-sg"
description = "Security group allowing communication within the VPC for ingress"
ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = [var.cidr_block]
description = "Allow all incoming connections within internal network"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow all outgoing connections within internal network"
}
tags = merge({
Name = "${var.network_name}-private-sg"
}, var.tags)
}
# Create protected security group for all communications strictly within the VPC
resource "aws_security_group" "protected_sg" {
# checkov:skip=CKV2_AWS_5: Attaching this security group to a resource depends on user
# checkov:skip=CKV_AWS_23: Rule description not required
count = var.create_sgs ? 1 : 0
vpc_id = aws_vpc.vpc.id
name = "${var.network_name}-protected-sg"
description = "Security group allowing all communications strictly within the VPC"
ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = [var.cidr_block]
description = "Allow all incoming connections within internal network"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = [var.cidr_block]
description = "Allow all outgoing connections within internal network"
}
tags = merge({
Name = "${var.network_name}-protected-sg"
}, var.tags)
}
# Create security group for public facing web servers or load balancer
resource "aws_security_group" "pub_sg" {
# checkov:skip=CKV2_AWS_5: Attaching this security group to a resource depends on user
# checkov:skip=CKV_AWS_23: Rule description not required
# checkov:skip=CKV_AWS_260: 80 ingress required
count = var.create_sgs ? 1 : 0
vpc_id = aws_vpc.vpc.id
name = "${var.network_name}-pub-web-sg"
description = "Security group allowing 80 and 443 from outer world"
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow incoming http connections"
}
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow incoming https connections"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow all outgoing connections"
}
tags = merge({
Name = "${var.network_name}-pub-web-sg"
}, var.tags)
}
# Create security group for internal web/app servers
resource "aws_security_group" "pvt_web_sg" {
# checkov:skip=CKV2_AWS_5: Attaching this security group to a resource depends on user
# checkov:skip=CKV_AWS_23: Rule description not required
count = var.create_sgs ? 1 : 0
vpc_id = aws_vpc.vpc.id
name = "${var.network_name}-pvt-web-sg"
description = "Security group allowing 80 and 443 internally for app servers"
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
security_groups = aws_security_group.pub_sg.*.id
description = "Allow incoming http connections from public sg"
}
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
security_groups = aws_security_group.pub_sg.*.id
description = "Allow incoming https connections from public sg"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow all outgoing connections"
}
tags = merge({
Name = "${var.network_name}-pvt-web-sg"
}, var.tags)
}
# Create cloudwatch log group for vpc flow logs
resource "aws_cloudwatch_log_group" "cw_log_group" {
count = var.create_flow_logs && var.flow_logs_destination == "cloud-watch-logs" && var.flow_logs_cw_log_group_arn == "" ? 1 : 0
name = "${var.network_name}-flow-logs-group"
retention_in_days = var.flow_logs_retention
kms_key_id = var.cw_log_group_kms_key_arn
tags = merge({
Name = "${var.network_name}-flow-logs-group"
}, var.tags)
}
# Create IAM role for VPC flow logs
resource "aws_iam_role" "flow_logs_role" {
count = var.create_flow_logs && var.flow_logs_destination == "cloud-watch-logs" && var.flow_logs_cw_log_group_arn == "" ? 1 : 0
name = "${var.network_name}-flow-logs-role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "vpc-flow-logs.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
tags = merge({
Name = "${var.network_name}-flow-logs-role"
}, var.tags)
}
# Create IAM policy for VPC flow logs role
resource "aws_iam_role_policy" "flow_logs_policy" {
count = var.create_flow_logs && var.flow_logs_destination == "cloud-watch-logs" && var.flow_logs_cw_log_group_arn == "" ? 1 : 0
name = "${var.network_name}-flow-logs-policy"
role = aws_iam_role.flow_logs_role[0].id
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
EOF
}
resource "random_id" "id" {
byte_length = 8
}
data "aws_kms_key" "s3" {
key_id = var.s3_kms_key
}
# Create S3 bucket for flow logs storage
resource "aws_s3_bucket" "flow_logs_bucket" {
# checkov:skip=CKV_AWS_19: Default SSE is in place
# checkov:skip=CKV_AWS_18: Access logging needs to be defined by user
# checkov:skip=CKV2_AWS_41: Access logging needs to be defined by user
# checkov:skip=CKV_AWS_144: CRR needs to be defined by user
# checkov:skip=CKV_AWS_145: Default SSE is in place
# checkov:skip=CKV2_AWS_40: Default SSE is in place
# checkov:skip=CKV_AWS_52: MFA delete needs to be defined by user
# checkov:skip=CKV_AWS_21: Versioning needs to be defined by user
# checkov:skip=CKV2_AWS_37: Versioning needs to be defined by user
# checkov:skip=CKV2_AWS_61: Llifecycle configuration needs to be defined by user
# checkov:skip=CKV2_AWS_62: Event notifications needs to be defined by user
count = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? 1 : 0
bucket = "${var.network_name}-flow-logs-${random_id.id.hex}"
force_destroy = var.s3_force_destroy
tags = merge({
Name = "${var.network_name}-flow-logs-${random_id.id.hex}"
}, var.tags)
}
resource "aws_s3_bucket_ownership_controls" "flow_logs_bucket" {
count = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? 1 : 0
bucket = join(",", aws_s3_bucket.flow_logs_bucket.*.id)
rule {
object_ownership = "BucketOwnerEnforced"
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "flow_logs_bucket" {
count = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? 1 : 0
bucket = join(",", aws_s3_bucket.flow_logs_bucket.*.id)
rule {
apply_server_side_encryption_by_default {
sse_algorithm = var.s3_kms_key == "alias/aws/s3" ? "AES256" : "aws:kms"
kms_master_key_id = var.s3_kms_key == "alias/aws/s3" ? null : data.aws_kms_key.s3.id
}
}
}
locals {
account_id = data.aws_caller_identity.current.account_id
region = data.aws_region.current.name
}
data "aws_iam_policy_document" "flow_logs_bucket" {
count = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? 1 : 0
statement {
sid = "AllowSSLRequestsOnly"
effect = "Deny"
actions = [
"s3:*"
]
principals {
type = "*"
identifiers = ["*"]
}
resources = [
join(",", aws_s3_bucket.flow_logs_bucket.*.arn),
"${join(",", aws_s3_bucket.flow_logs_bucket.*.arn)}/*"
]
condition {
test = "Bool"
variable = "aws:SecureTransport"
values = ["false"]
}
}
statement {
sid = "AWSLogDeliveryWrite"
effect = "Allow"
actions = [
"s3:PutObject"
]
principals {
type = "Service"
identifiers = ["delivery.logs.amazonaws.com"]
}
resources = [
"${join(",", aws_s3_bucket.flow_logs_bucket.*.arn)}/*"
]
condition {
test = "StringEquals"
variable = "aws:SourceAccount"
values = [local.account_id]
}
condition {
test = "StringEquals"
variable = "s3:x-amz-acl"
values = ["bucket-owner-full-control"]
}
condition {
test = "ArnLike"
variable = "aws:SourceArn"
values = ["arn:aws:logs:${local.region}:${local.account_id}:*"]
}
}
statement {
sid = "AWSLogDeliveryAclCheck"
effect = "Allow"
actions = [
"s3:GetBucketAcl"
]
principals {
type = "Service"
identifiers = ["delivery.logs.amazonaws.com"]
}
resources = [
join(",", aws_s3_bucket.flow_logs_bucket.*.arn)
]
condition {
test = "StringEquals"
variable = "aws:SourceAccount"
values = [local.account_id]
}
condition {
test = "ArnLike"
variable = "aws:SourceArn"
values = ["arn:aws:logs:${local.region}:${local.account_id}:*"]
}
}
}
resource "aws_s3_bucket_policy" "flow_logs_bucket" {
count = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? 1 : 0
bucket = join(",", aws_s3_bucket.flow_logs_bucket.*.id)
policy = join(",", data.aws_iam_policy_document.flow_logs_bucket.*.json)
}
resource "aws_s3_bucket_public_access_block" "flow_logs_bucket" {
count = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? 1 : 0
bucket = join(",", aws_s3_bucket.flow_logs_bucket.*.id)
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
locals {
flow_logs_log_group_arn = var.create_flow_logs && var.flow_logs_destination == "cloud-watch-logs" && var.flow_logs_cw_log_group_arn == "" ? aws_cloudwatch_log_group.cw_log_group[0].arn : var.flow_logs_cw_log_group_arn
flow_logs_bucket_arn = var.create_flow_logs && var.flow_logs_destination == "s3" && var.flow_logs_bucket_arn == "" ? aws_s3_bucket.flow_logs_bucket[0].arn : var.flow_logs_bucket_arn
}
# Create VPC flow logs
resource "aws_flow_log" "flow_logs" {
count = var.create_flow_logs ? 1 : 0
iam_role_arn = var.flow_logs_destination == "cloud-watch-logs" ? aws_iam_role.flow_logs_role[0].arn : null
log_destination = var.flow_logs_destination == "cloud-watch-logs" ? local.flow_logs_log_group_arn : local.flow_logs_bucket_arn
log_destination_type = var.flow_logs_destination
log_format = var.flow_logs_log_format
traffic_type = "ALL"
vpc_id = aws_vpc.vpc.id
dynamic "destination_options" {
for_each = var.create_flow_logs && var.flow_logs_destination == "s3" ? [0] : []
content {
file_format = var.flow_logs_s3_file_format
hive_compatible_partitions = var.flow_logs_s3_hive_compatible_partitions
per_hour_partition = var.flow_logs_s3_per_hour_partition
}
}
tags = merge({
Name = "${var.network_name}-flow-logs"
}, var.tags)
}
# Create private hosted zone
resource "aws_route53_zone" "private" {
# checkov:skip=CKV2_AWS_39: Query logging
# checkov:skip=CKV2_AWS_38: DNSSEC logging
count = var.create_private_zone == true ? 1 : 0
name = var.private_zone_domain
vpc {
vpc_id = aws_vpc.vpc.id
}
tags = merge({
Name = "${var.network_name}-pvt-zone"
}, var.tags)
}