82 lines
1.6 KiB
HCL
82 lines
1.6 KiB
HCL
variable "rg_name" {
|
|
type = string
|
|
}
|
|
|
|
variable "location" {
|
|
type = string
|
|
}
|
|
|
|
variable "base_name" {
|
|
type = string
|
|
default = null
|
|
}
|
|
|
|
variable "name" {
|
|
type = string
|
|
default = null
|
|
|
|
validation {
|
|
condition = (
|
|
(var.name != null && trimspace(var.name) != "") ||
|
|
(var.base_name != null && trimspace(var.base_name) != "")
|
|
)
|
|
error_message = "Provide name or base_name with a non-empty value."
|
|
}
|
|
}
|
|
|
|
variable "account_tier" {
|
|
type = string
|
|
default = "Standard"
|
|
}
|
|
|
|
variable "account_replication_type" {
|
|
type = string
|
|
default = "LRS"
|
|
}
|
|
|
|
variable "allow_nested_items_to_be_public" {
|
|
type = bool
|
|
default = false
|
|
}
|
|
|
|
variable "public_network_access_enabled" {
|
|
type = bool
|
|
default = true
|
|
}
|
|
|
|
variable "tags" {
|
|
type = map(string)
|
|
default = {}
|
|
|
|
description = "A map of tags to apply to the storage account resource."
|
|
}
|
|
|
|
variable "containers" {
|
|
type = map(object({
|
|
name = string
|
|
container_access_type = string
|
|
}))
|
|
|
|
default = {}
|
|
|
|
# Separate validations to provide specific error messages for each condition
|
|
validation {
|
|
condition = alltrue([
|
|
for container in values(var.containers) : (
|
|
container.name != null &&
|
|
trimspace(container.name) != ""
|
|
)
|
|
])
|
|
error_message = "container name must be a non-empty string."
|
|
}
|
|
|
|
validation {
|
|
condition = alltrue([
|
|
for container in values(var.containers) :
|
|
contains(["private", "blob", "container"], container.container_access_type)
|
|
])
|
|
|
|
error_message = "container_access_type must be one of 'private', 'blob', or 'container'."
|
|
}
|
|
}
|