skip to Main Content

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,
  ]
}

2

Answers


  1. Failure sending request:
    │ StatusCode=400 — Original Error: Code="InvalidTimezone" Message="’America/Indianapolis’ is not a supported timezone."

    I can reproduce the same issue when using the same terraform code.

    The cause of the issue is that the time zone value: EST or America/Indianapolis is not valid.

    To solve this issue, you can set the timezone_id to US Eastern Standard Time to use the EST Time zone.

    Terraform sample:

      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 = "US Eastern Standard Time"
      depends_on = [
        azurerm_subnet_network_security_group_association.sql-subnet-nsg-association,
        azurerm_subnet_route_table_association.sql-subnet-route-table-association,
      ]
    }
    
    Login or Signup to reply.
  2. 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.

    enter image description here

    Reference: azurerm_mssql_managed_instance

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search