Created
October 6, 2022 17:43
-
-
Save guillermo-musumeci/95944ed9f127328a0f0aaf6f3ec0508a to your computer and use it in GitHub Desktop.
Variable Validation in Terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| variable "ip_address" { | |
| type = string | |
| description = "Web Server IP address" | |
| validation { | |
| condition = can(regex("^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$",var.ip_address)) | |
| error_message = "Invalid Web Server IP address provided" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment