Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"unknown time zone <timezone>" on azurerm_automation_schedule #20690

Closed
1 task done
matteo-finistauri opened this issue Feb 28, 2023 · 7 comments · Fixed by #20765
Closed
1 task done

"unknown time zone <timezone>" on azurerm_automation_schedule #20690

matteo-finistauri opened this issue Feb 28, 2023 · 7 comments · Fixed by #20765
Labels
Milestone

Comments

@matteo-finistauri
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

2.3.0

AzureRM Provider Version

3.45.0

Affected Resource(s)/Data Source(s)

azurerm_automation_schedule

Terraform Configuration Files

terraform {
  backend "azurerm" {
    resource_group_name  = "MyResourceGroup"
    storage_account_name = "terraform12345"
    container_name       = "tstate"
    key                  = "terraform.tfstate"
  }
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 2.64.0, != 2.86.0"

    }
  }
}

# Configure the Microsoft Azure Provider
provider "azurerm" {
  skip_provider_registration = true
  features {
    key_vault {
      purge_soft_delete_on_destroy = true
    }
  }
}
resource "azurerm_resource_group" "rg" {
  name     = "MyResourceGroup"
  location = "northeurope"
}

resource "azurerm_automation_account" "automation_account" {
  name                = "autom-dev"
  location            = "westeurope"
  resource_group_name = "MyResourceGroup"
  sku_name            = "Basic"
  identity {
    type = "SystemAssigned"
  }
}

resource "azurerm_automation_schedule" "restart_app_service_during_the_night_schedule" {
  name                    = "RestartAppServiceDuringTheNightSchedule"
  resource_group_name     = "MyResourceGroup"
  automation_account_name = azurerm_automation_account.automation_account.name
  frequency               = "Week"
  interval                = 1
  timezone                = "Europe/Rome"
  start_time              = "2023-01-26T03:00:00+01:00"
  description             = "Schedule for restart of App Service during the night"
  week_days               = ["Monday", "Thursday"]
}

Debug Output/Panic Output

│ Error: unknown time zone Europe/Rome
│
│   with module.automation.azurerm_automation_schedule.restart_app_service_during_the_night_schedule[0],
│   on ..\modules\automation\restartAppServiceDuringTheNight.tf line 25, in resource "azurerm_automation_schedule" "restart_app_service_during_the_night_schedule":
│   25: resource "azurerm_automation_schedule" "restart_app_service_during_the_night_schedule" {

Expected Behaviour

The resource "azurerm_automation_schedule" should be created.

Actual Behaviour

I receive the error specified before. I tried also to remove the "timezone" property, since there is a default value (UTC). I receive the same error with reference to UTC timezone.

Steps to Reproduce

  1. Create a resource group named "MyResourceGroup"
  2. Create a Storage Account named "terraform12345"
  3. Create a blob container named "tstate"
  4. Create a configuration file like the one specified above.
  5. terraform init
  6. terraform apply

Important Factoids

No response

References

No response

@github-actions github-actions bot removed the bug label Feb 28, 2023
@matteo-finistauri matteo-finistauri changed the title "unknown time zone Europe/Rome" on azurerm_automation_schedule "unknown time zone <timezone>" on azurerm_automation_schedule Feb 28, 2023
@naikpriti
Copy link

I see this issue too.

@DSollick
Copy link
Contributor

I've been able to confirm that it works as expected in 3.44.1 and it only breaks in 3.45

I have to imagine it's due to #20568 - something different about how the new azure-go-sdk parses time zones?

@mishya02
Copy link

mishya02 commented Feb 28, 2023

Hitting the same issue with v3.45.0.

Updating provider constraint to skip 3.45.0 worked like a charm!
azurerm = { source = "hashicorp/azurerm" version = ">= 3.0.0, != 3.45.0" }

@benjamin-v1
Copy link

Also, when leaving timezone out of the resource, it defaults to Etc/UTC and also errors saying that timezone is unknown:

CONFIG

resource "azurerm_automation_schedule" "example" {
  name                    = "automation-schedule"
  resource_group_name     = data.azurerm_resource_group.example.name
  automation_account_name = azurerm_automation_account.example.name
  frequency               = "Week"
  interval                = 1
  start_time              = "2024-02-24T17:22:48Z"
}

PLAN

  # azurerm_automation_schedule.example will be created
  + resource "azurerm_automation_schedule" "example" {
      + automation_account_name = "test-aa"
      + expiry_time             = (known after apply)
      + frequency               = "Week"
      + id                      = (known after apply)
      + interval                = 1
      + name                    = "automation-schedule"
      + resource_group_name     = "test-rg"
      + start_time              = "2024-02-24T17:22:48Z"
      + timezone                = "Etc/UTC"
    }

RESULT

│ Error: unknown time zone Etc/UTC
│
│   with azurerm_automation_schedule.example,
│   on main.tf line 40, in resource "azurerm_automation_schedule" "example":
│   40: resource "azurerm_automation_schedule" "example" {
│

@wuxu92
Copy link
Contributor

wuxu92 commented Mar 3, 2023

Hi all thanks for your feedback. I find below code introduced this issue in #20568, and i am working on fix it now.

loc, err := time.LoadLocation(timeZone)
if err != nil {
return err
}

@github-actions
Copy link

This functionality has been released in v3.47.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
7 participants