-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
variables.tf
81 lines (68 loc) · 2.71 KB
/
variables.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
variable "name" {
type = string
description = "The name of the virtual network."
}
variable "resource_group_name" {
type = string
description = "The name of the resource group in which to create the virtual network."
}
variable "location" {
type = string
description = "The location/region where the virtual network is created."
}
variable "tags" {
type = map(string)
default = {}
description = "A mapping of tags to assign to the resource."
}
variable "address_space" {
type = list(string)
description = "The address space that is used in the virtual network. More than one address space can be provisioned."
validation {
condition = can([for ip in var.address_space : cidrsubnet(ip, 0, 0)])
error_message = "All value must be a valid IP range in CIDR format."
}
}
variable "dns_servers" {
type = list(string)
default = []
description = "List of IP addresses of DNS servers."
validation {
condition = can([for ip in var.dns_servers : cidrnetmask("${ip}/32")])
error_message = "All value must be a valid IP address."
}
}
variable "ddos_protection_plan_id" {
type = string
default = null
description = "The ID of DDoS Protection Plan."
}
variable "bgp_community" {
type = string
default = null
description = "The BGP community attribute in format `<as-number>:<community-value>`. The as-number segment is the Microsoft ASN, which is always 12076 for now."
validation {
condition = var.bgp_community == null ? true : length(split(":", var.bgp_community)) == 2
error_message = "The value must be a BGP community range in <as-number>:<community-value> format."
}
validation {
condition = var.bgp_community == null ? true : split(":", var.bgp_community)[0] == "12076"
error_message = "The as-number must be 12076."
}
validation {
condition = var.bgp_community == null ? true : split(":", var.bgp_community)[1] >= 20000 && split(":", var.bgp_community)[1] <= 49999
error_message = "The community-value must between 20000 and 49999."
}
}
variable "subnets" {
type = list(object({
name = string
address_prefixes = list(string)
service_endpoints = optional(list(string))
delegation = optional(string)
private_endpoint_network_policies_enabled = optional(bool)
private_link_service_network_policies_enabled = optional(bool)
}))
default = []
description = "List of objects that represent the configuration of each subnet."
}