Skip to content

Commit

Permalink
add: variables improved
Browse files Browse the repository at this point in the history
  • Loading branch information
jordi.bru committed May 27, 2024
1 parent 21d8f58 commit d3ade67
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
# REQUIRED VARIABLES

variable "stage" {
description = "Stage of development"
description = "The stage of development (e.g., test, dev, staging, prod)."
type = string

validation {
condition = can(regex("^(test|dev|stagin|prod)$", var.stage))
error_message = "Stage must be dev, staging or prod."
condition = can(regex("^(test|dev|staging|prod)$", var.stage))
error_message = "Stage must be one of the following: test, dev, staging, prod."
}
}

variable "purpose" {
description = "Short description about the created resource"
description = "A short description about the purpose of the created resource."
type = string
default = null

validation {
condition = can(regex("^([a-zA-Z0-9-_]*)$", var.purpose))
error_message = "Only the expression [a-zA-Z0-9-_]* is allowed."
error_message = "Only the characters [a-zA-Z0-9-_] are allowed."
}
}

variable "owner" {
description = "Owner of the deployed infrastructure"
description = "The owner of the deployed infrastructure."
type = string
default = null

validation {
condition = length(var.owner) >= 3
error_message = "You must define an owner with more than three letters."
error_message = "The owner name must be at least three characters long."
}
}

# CUSTOM VARIABLES

variable "domain_name" {
description = "Name of the domain"
description = "The name of the domain to attach the certificate."
type = string
default = null

validation {
condition = length(var.domain_name) >= 3
error_message = "You must define a domain name that exists on the account."
error_message = "You must define a domain name with at least three characters that exists on the account."
}
}

variable "validate_cert" {
description = "Validate the certificate"
description = "Indicate whether to validate the certificate."
type = bool
default = true
}

variable "zone_name" {
description = "route53 zone name"
type = string
default = "jordibru.cloud"
}
description = "The name of the Route 53 hosted zone."
type = string
default = "jordibru.cloud"
}

0 comments on commit d3ade67

Please sign in to comment.