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

Terraform Azure Data Factory Trigger Schedule - Error When Using Activated With Schedule Block #14384

Closed
jguevara-wooliesx opened this issue Nov 30, 2021 · 6 comments · Fixed by #14391

Comments

@jguevara-wooliesx
Copy link

I've created a new datafactory pipeline trigger meant to invoke every 5th of the month at 13:00 UTC using Terraform. This was achieved using azurerm_data_factory_trigger_schedule resource key.

However, as the trigger Status doesn't automatically get set to Started on deploy, I used the activated property in an attempt to set it. This is following the updates made on this PR: #13390

However, adding activated causes an error on deployment.

The Terraform script I'm using is as follows:

resource "azurerm_data_factory_trigger_schedule" "pipeline_trigger" {
  name                = "Pipeline_MonthlyTrigger"
  data_factory_name   = "dataFactoryName"
  resource_group_name = "resourceGroupName"
  pipeline_name       = "pipelineName"

  frequency           = "Month"
  interval            = 1

  activated           = true

  schedule  {
    days_of_month     = [4]
    hours             = [13]
    minutes           = [0]
  }
}

The error that comes up on deployment:

The recurrence schedule of trigger could not have 'WeekDays' for recurrence frequency 'Month'." Target="Pipeline_MonthlyTrigger"

I raised a similar question on Stackoverflow and was told that this is most likely a bug on the newly added support for activated clashing with schedule block.

@aristosvo
Copy link
Collaborator

aristosvo commented Nov 30, 2021

Hi @mysterygrocer! Thanks for raising this issue!

I expected it to be a configuration confusion mistake, this is how I expected it to work (but it doesn't):

resource "azurerm_data_factory_trigger_schedule" "example" {
  name                = "example"
  data_factory_name   = azurerm_data_factory.example.name
  resource_group_name = azurerm_resource_group.example.name
  pipeline_name       = azurerm_data_factory_pipeline.example.name

  annotations = ["test1", "test2", "test3"]
  frequency   = "Month"
  interval    = 1
  activated   = true

  schedule {
    monthly {
      weekday = "Monday"
      week    = 1
    }
  }
}

I'll submit a fix and tests to validate the behaviour as soon as possible.

@Grigoriy0
Copy link

I was faced with the similar issue today. How can I specify the hourly time for the trigger?

resource "azurerm_data_factory_trigger_schedule" "daily" {
  data_factory_name   = var.data_factory_name
  name                = var.name
  pipeline_name       = var.pipeline_name
  resource_group_name = var.resource_group_name
  activated           = true
  interval            = 1
  frequency           = "Hour"

  schedule {
      days_of_month = []
      days_of_week  = []
      hours         = range(1, 25)
      minutes       = [0]
  }
}

With activated = true an API returns some errors, from "The recurrence schedule of trigger has an invalid recurrence frequency 'Hour'" to "The recurrence of trigger has an invalid start time '2021-11-30T09:49:23.6373031+00:00' zone designator for time zone 'UTC'"

An interesting thing: the trigger is created inactive, but terraform tries to create it again. Azure API returns "400" errors, but creates the disabled trigger.
Only if I delete schedule block it will be successfully created in activated state.

@aristosvo
Copy link
Collaborator

@Grigoriy0 Working on it!

I'm adding some tests to validate the behaviour and interaction with the Azure API in the Terraform Provider in more detail, as current tests were not validated completely as schedules weren't activated. Almost there!

@aristosvo aristosvo added bug and removed question labels Nov 30, 2021
@jguevara-wooliesx
Copy link
Author

Thanks for the quick fix on this @aristosvo ! Will catch the fix you made when it gets included on the next Release.

katbyte pushed a commit that referenced this issue Dec 4, 2021
@github-actions github-actions bot added this to the v2.89.0 milestone Dec 4, 2021
@github-actions
Copy link

This functionality has been released in v2.89.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 Jan 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants