Added module code.

This commit is contained in:
2026-02-20 08:18:05 +01:00
parent cb7a745b19
commit ba7be7d8d9
5 changed files with 157 additions and 0 deletions

81
variables.tf Normal file
View File

@@ -0,0 +1,81 @@
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'."
}
}