-
Notifications
You must be signed in to change notification settings - Fork 1
/
vars.tf
77 lines (64 loc) · 2.47 KB
/
vars.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
variable "name" {
type = string
description = "Name of the created VPC"
}
variable "region" {
type = string
description = "Name of AWS region to use for cluster"
}
variable "vpc_cidr" {
type = string
default = "172.20.0.0/16"
description = "CIDR range for the VPC?"
validation {
condition = cidrsubnet(var.vpc_cidr, 3, 5) != ""
error_message = "A larger CIDR range must be provided."
}
}
variable "public_subnet_zones" {
type = list(string)
default = ["a", "b", "c"]
description = "The public subnet group zones. If private_subnet_zones is set the values from that variable will be used instead and these ignored"
}
variable "additional_public_subnet_tags" {
type = map(string)
default = {}
description = "Additional tags for public subnets."
}
variable "public_subnet_cidrs" {
type = map(string)
default = {}
description = "Override generated CIDRs for public subnets. If specified, this list must match public_subnet_zones."
}
variable "private_subnet_zones" {
type = list(string)
default = []
description = "The private subnet group zones"
}
variable "additional_private_subnet_tags" {
type = map(string)
default = {}
description = "Additional tags for private subnets."
}
variable "private_subnet_cidrs" {
type = map(string)
default = {}
description = "Override generated CIDRs for private subnets. If specified, this list must match private_subnet_zones."
}
variable "s3_service_endpoint" {
type = bool
default = false
description = "Generate a Service Endpoint to S3 for the created VPC. https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html"
}
resource "null_resource" "private_subnet_zones_check" {
count = length(var.private_subnet_zones) > 3 ? "No more than 3 private zones can be provided." : 0
}
resource "null_resource" "public_subnet_zones_check_0" {
count = length(var.private_subnet_zones) > 3 ? "No more than 3 public zones can be provided." : 0
}
resource "null_resource" "public_subnet_zones_check_1" {
count = length(var.public_subnet_zones) < 1 && length(var.public_subnet_cidrs) < 1 ? "At least one public zone (or override) must be provided." : 0
}
resource "null_resource" "public_private_subnet_zones_check" {
count = length(var.private_subnet_cidrs) > 0 && (keys(var.private_subnet_cidrs) != keys(var.public_subnet_cidrs)) ? "The same zones must be supplied when overriding CIDRs" : 0
}