Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix additional bandwidth #47

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions modules/c8000v-sdwan/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@ variable "secondary" {
error_message = "Key 'metro_code' has to be defined for secondary device. Valid metro code consists of two capital letters, i.e. SV, DC."
}
validation {
condition = try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001, true)
condition = try(!var.secondary.enabled || var.secondary.additional_bandwidth == "0" || (var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001), true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 2001 Mbps."
}

validation {
condition = try(!var.secondary.enabled || (length(var.secondary.account_number) > 0 && var.secondary.account_number != null), true)
error_message = "Secondary account number must not be blank or null when secondary is enabled."
}

validation {
condition = try(!var.secondary.enabled || length(var.secondary.cloud_init_file_id) > 0, true)
error_message = "Secondary Cloud-Init bootstrap file is mandatory."
Expand Down
4 changes: 3 additions & 1 deletion modules/c8000v/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ variable "connectivity" {
variable "additional_bandwidth" {
description = "Additional internet bandwidth for a device"
type = number
default = 0
validation {
condition = var.additional_bandwidth == 0 || (var.additional_bandwidth >= 25 && var.additional_bandwidth <= 5001)
error_message = "Additional internet bandwidth should be between 25 and 5001 Mbps."
}
}

variable "ssh_key" {
description = "SSH public key for a device"
type = object({
Expand Down Expand Up @@ -141,7 +143,7 @@ variable "secondary" {
error_message = "Key 'hostname' has to be defined for secondary device. Valid hostname has to be from 2 to 10 characters long."
}
validation {
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001, true)
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth == "0" || (var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001), true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 5001 Mbps."
}
validation {
Expand Down
2 changes: 1 addition & 1 deletion modules/fortigate-firewall/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ variable "secondary" {
error_message = "Key 'account_number' is required for secondary device."
}
validation {
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001, true)
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth == "0" || (var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001), true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 5001 Mbps."
}
validation {
Expand Down
2 changes: 1 addition & 1 deletion modules/nginx/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ variable "secondary" {
error_message = "Key 'hostname' has to be defined for secondary device. Valid hostname has to be from 2 to 10 characters long."
}
validation {
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 2001, true)
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth == "0" || (var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 2001), true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 2001 Mbps."
}
validation {
Expand Down
2 changes: 1 addition & 1 deletion modules/palo-alto-network-firewall/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ variable "secondary" {
error_message = "Key 'hostname' has to be defined for secondary device. Valid hostname has to be from 2 to 10 characters long."
}
validation {
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 2001, true)
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth == "0" || (var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 2001), true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 2001 Mbps."
}
validation {
Expand Down
2 changes: 1 addition & 1 deletion modules/velocloud-sdwan/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ variable "secondary" {
}

validation {
condition = try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001, true)
condition = !try(var.secondary.enabled, false) || try(var.secondary.additional_bandwidth == "0" || (var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001), true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 5001 Mbps."
}

Expand Down
Loading