I am trying to crease a managed SQL instance in Azure and keep running into issues with the timezone. I am trying to use the EST timezone. I have tried EST
and America/Indianapolis
and I am still unable to resolve the error. I keep getting this error
Failure sending request:
│ StatusCode=400 -- Original Error: Code="InvalidTimezone" Message="'America/Indianapolis' is not a supported timezone."
Below is the TF been used to create this resource. Any help is greatly appreciated.
resource "azurerm_mssql_managed_instance" "sql" {
name = var.sql_instance_name
resource_group_name = azurerm_resource_group.az-rg-details.name
location = azurerm_resource_group.az-rg-details.location
administrator_login = var.admin_login
administrator_login_password = var.admin_password
license_type = "BasePrice"
subnet_id = azurerm_subnet.sql-subnet.id
sku_name = var.sku_name
vcores = var.vcores
storage_size_in_gb = var.storage_size_in_gb
timezone_id = "America/Indianapolis"
depends_on = [
azurerm_subnet_network_security_group_association.sql-subnet-nsg-association,
azurerm_subnet_route_table_association.sql-subnet-route-table-association,
]
}
Timezone error creating SQL instance in Azure using Terraform
The above error you encountered is due to an incorrect time zone ID being passed in the Terraform code. If you want to create the EST time zone, you can use the time zone ID below. For more details about supported Time Zone IDs for Azure SQL Managed Instance, follow the MS Doc.
Eastern Standard Time
Canada Central Standard Time
US Eastern Standard Time
Here is the updated terraform code to create Azure SQL Managed Instance in EST Time Zone
.
provider "azurerm" {
features {}
subscription_id = "8332bf56-aa7c-4daa-a507-d7e60e5f09a9"
}
resource "azurerm_resource_group" "example" {
name = "sqldb-rg"
location = "East US"
}
resource "azurerm_virtual_network" "example" {
name = "sql-vnet"
resource_group_name = azurerm_resource_group.example.name
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
}
resource "azurerm_subnet" "example" {
name = "sql-subnet"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.0.0/24"]
delegation {
name = "managedinstancedelegation"
service_delegation {
name = "Microsoft.Sql/managedInstances"
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action", "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action"]
}
}
}
resource "azurerm_mssql_managed_instance" "example" {
name = "sqldemodatabasetest"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
license_type = "BasePrice"
sku_name = "GP_Gen5"
storage_size_in_gb = 32
subnet_id = azurerm_subnet.example.id
vcores = 4
timezone_id = "Eastern Standard Time"
administrator_login = "Venkat"
administrator_login_password = "Qazwsxedc!23rfnhkt"
}
After running the terraform , the SQL managed instance has been created successfully in EST Time Zone.
Reference: azurerm_mssql_managed_instance