Added validation for workspace sku

This commit is contained in:
Tom Archer 2023-05-12 17:30:37 -07:00
parent 71cee46b77
commit 669f6c96c6
2 changed files with 9 additions and 4 deletions

View File

@ -25,8 +25,8 @@ This template provisions an [AKS / Azure Kubernetes service (also known as a Man
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg | | `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
| `resource_group_location` | Location of the resource group. | eastus | | `resource_group_location` | Location of the resource group. | eastus |
| `node_count` | Initial number of nodes which should exist in this Node Pool. Value must be between 1 and 1000. | 3 | | `node_count` | Initial number of nodes which should exist in this Node Pool. Value must be between 1 and 1000. | 3 |
| `log_analytics_workspace_location` | Location of the log analytics workspace. | eastus | | `log_analytics_workspace_location` | Location of the Log Analytics workspace. | eastus |
| `log_analytics_workspace_sku` | SKU of the Log Analytics Workspace. | PerGB2018 | | `log_analytics_workspace_sku` | SKU of the Log Analytics workspace. The SKU of the log analytics workspace. Choose from: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018 | PerGB2018 |
## Example ## Example

View File

@ -21,15 +21,20 @@ variable "node_count" {
variable "log_analytics_workspace_location" { variable "log_analytics_workspace_location" {
type = string type = string
default = "eastus" default = "eastus"
description = "Location of the log analytics workspace." description = "Location of the Log Analytics workspace."
} }
# For Log Analytics pricing, refer to: # For Log Analytics pricing, refer to:
# https://azure.microsoft.com/pricing/details/monitor # https://azure.microsoft.com/pricing/details/monitor
variable "log_analytics_workspace_sku" { variable "log_analytics_workspace_sku" {
type = string type = string
description = "" description = "The SKU of the Log Analytics workspace. Choose from: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018"
default = "PerGB2018" default = "PerGB2018"
validation {
condition = contains(["Free", "PerNode", "Premium", "Standard", "Standalone", "Unlimited", "CapacityReservation", "PerGB2018"], var.log_analytics_workspace_sku)
error_message = "The Log Analytics workspace SKU must be one of the following: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018"
}
} }
variable "msi_id" { variable "msi_id" {