updated variables.tf with formatting and validation blocks where needed

This commit is contained in:
Eric D 2023-09-26 10:16:31 -04:00
parent efb8d0f25c
commit f46699d1f2

View File

@ -1,41 +1,48 @@
variable "resource_group_location" { variable "resource_group_location" {
description = "The location where the resource group should be created."
type = string type = string
default = "East US" default = "East US"
description = "The location where the resource group should be created."
} }
variable "prefix" { variable "prefix" {
description = "A prefix for naming resources."
type = string type = string
default = "demo" default = "demo"
description = "A prefix for naming resources."
} }
variable "vnet_address_space" { variable "vnet_address_space" {
description = "Address space for the virtual network."
type = list(string) type = list(string)
default = ["10.0.0.0/16"] default = ["10.0.0.0/16"]
description = "Address space for the virtual network."
} }
variable "subnet_address_prefixes" { variable "subnet_address_prefixes" {
description = "Address prefixes for the subnet."
type = list(string) type = list(string)
default = ["10.0.1.0/24"] default = ["10.0.1.0/24"]
description = "Address prefixes for the subnet."
} }
variable "public_ip_allocation_method" { variable "public_ip_allocation_method" {
description = "Allocation method for the public IP."
type = string type = string
default = "Dynamic" default = "Dynamic"
description = "Allocation method for the public IP."
validation {
condition = contains(["Static", "Dynamic"], var.public_ip_allocation_method)
error_message = "The public IP allocation method must be either 'Static' or 'Dynamic'."
}
} }
variable "vm_size" { variable "vm_size" {
description = "Size of the virtual machine."
type = string type = string
default = "Standard_DS1_v2" default = "Standard_DS1_v2"
description = "Size of the virtual machine."
validation {
condition = contains(["Standard_DS1_v2", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2"], var.vm_size)
error_message = "The VM size must be one of the following: Standard_DS1_v2, Standard_DS2_v2, Standard_DS3_v2, Standard_DS4_v2, Standard_DS5_v2."
}
} }
variable "vm_image" { variable "vm_image" {
description = "Source image reference for the virtual machine."
type = object({ type = object({
publisher = string publisher = string
offer = string offer = string
@ -48,46 +55,59 @@ variable "vm_image" {
sku = "2022-datacenter-azure-edition" sku = "2022-datacenter-azure-edition"
version = "latest" version = "latest"
} }
description = "Source image reference for the virtual machine."
} }
variable "storage_account_tier" { variable "storage_account_tier" {
description = "Performance tier of the storage account."
type = string type = string
default = "Standard" default = "Standard"
description = "Performance tier of the storage account."
validation {
condition = contains(["Standard", "Premium", "Standard_GRS", "Standard_RAGRS", "Premium_LRS", "Premium_ZRS"], var.storage_account_tier)
error_message = "The storage account tier must be one of the following: Standard, Premium, Standard_GRS, Standard_RAGRS, Premium_LRS, Premium_ZRS."
}
} }
variable "storage_account_replication_type" { variable "storage_account_replication_type" {
description = "Replication type for the storage account."
type = string type = string
default = "LRS" default = "LRS"
description = "Replication type for the storage account."
validation {
condition = contains(["LRS", "GRS", "RAGRS", "ZRS"], var.storage_account_replication_type)
error_message = "The storage account replication type must be one of the following: LRS, GRS, RAGRS, ZRS."
}
} }
variable "automation_account_sku_name" { variable "automation_account_sku_name" {
description = "SKU name for the Azure Automation Account."
type = string type = string
default = "Basic" default = "Basic"
description = "SKU name for the Azure Automation Account."
validation {
condition = contains(["Free", "Basic", "Standard"], var.automation_account_sku_name)
error_message = "The automation account SKU name must be one of the following: Free, Basic, Standard."
}
} }
variable "runbook_type" { variable "runbook_type" {
description = "Type of the runbook."
type = string type = string
default = "PowerShell" default = "PowerShell"
description = "Type of the runbook."
} }
variable "runbook_uri" { variable "runbook_uri" {
description = "URI for the runbook content."
type = string type = string
default = "https://example.com/script.ps1" default = "https://example.com/script.ps1"
description = "URI for the runbook content."
} }
variable "one_time_schedule_start_time" { variable "one_time_schedule_start_time" {
description = "Start time for the one-time runbook schedule."
type = string type = string
default = "2023-09-23T00:00:00Z" default = "2023-09-23T00:00:00Z"
description = "Start time for the one-time runbook schedule."
} }
variable "hourly_schedule_start_time" { variable "hourly_schedule_start_time" {
description = "Start time for the hourly runbook schedule."
type = string type = string
default = "2023-09-23T01:00:00Z" default = "2023-09-23T01:00:00Z"
} description = "Start time for the hourly runbook schedule."
}