Skip to content

Commit 6627f8c

Browse files
authored
Merge pull request #3 from my0373/feature_variable_validation
Added some additional variable validation
2 parents d3c95fc + 3e3be5d commit 6627f8c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

variables.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
11
variable "aws_region" {
22
type = string
33
default = "us-east-1"
4+
description = "value for the AWS region to deploy resources in, e.g. us-east-1, eu-west-2."
5+
validation {
6+
condition = can(regex("^(us|eu|ap|sa|ca)-[a-z]+-[1-9]$", var.aws_region))
7+
error_message = "Invalid AWS region format. Use 'us-east-1', 'eu-west-2', etc."
8+
}
49
}
510

611
variable "nbe_token" {
712
type = string
813
sensitive = true
14+
description = "token supplied by Netbox Labs for your NetBox Enterprise instance."
15+
validation {
16+
condition = length(var.nbe_token) > 0
17+
error_message = "NetBox Enterprise token must not be empty."
18+
}
919
}
1020

1121
variable "nbe_console_password" {
1222
type = string
1323
sensitive = true
24+
description = "A password of at least 6 characters for the NetBox Enterprise console user."
25+
validation {
26+
condition = length(var.nbe_console_password) >= 6
27+
error_message = "NetBox Enterprise console password must be at least 6 characters long."
28+
}
1429
}
1530

1631
variable "nbe_admin_password" {
1732
type = string
1833
sensitive = true
34+
description = "A password of at least 12 characters for the NetBox Enterprise admin user."
35+
validation {
36+
condition = length(var.nbe_admin_password) >= 12
37+
error_message = "NetBox Enterprise admin password must be at least 12 characters long."
38+
}
1939
}
2040

2141
variable "postgres_password" {
2242
type = string
2343
sensitive = true
44+
description = "A password of at least 8 characters for the PostgreSQL database."
45+
validation {
46+
condition = length(var.postgres_password) >= 8
47+
error_message = "PostgreSQL password must be at least 8 characters long."
48+
}
2449
}

0 commit comments

Comments
 (0)