Files
terraform-azurerm-storage-a…/variables.tf
2026-02-20 08:18:05 +01:00

82 lines
1.7 KiB
HCL

variable "rg_name" {
type = string
}
variable "location" {
type = string
}
variable "storage_account_base_name" {
type = string
default = null
}
variable "storage_account_name" {
type = string
default = null
validation {
condition = (
(var.storage_account_name != null && trimspace(var.storage_account_name) != "") ||
(var.storage_account_base_name != null && trimspace(var.storage_account_base_name) != "")
)
error_message = "Provide storage_account_name or storage_account_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'."
}
}