airbytehq / terraform-provider-airbyte

Terraform Provider for Airbyte API
https://api.airbyte.com/
MIT License
39 stars 16 forks source link

Cron timezone #48

Open KimPlv opened 8 months ago

KimPlv commented 8 months ago

Is it possible to have a cron expression with a time zone other than UTC?

schedule = {
    schedule_type   = "cron"
    cron_expression = "0 20 0 * * ? Europe/ Paris"
  }
OhadSrur commented 1 month ago

Hi, I'm having the same issue. Would it be possible to allow any other timezone?

hongbo-miao commented 1 week ago

Hi @KimPlv @OhadSrur I believe new version already supports (I am using vO.63.3)

image

But there is a not convenient issue when use timezone that is not UTC, I posted at https://github.com/airbytehq/terraform-provider-airbyte/issues/121

OhadSrur commented 1 week ago

Hi @hongbo-miao , Yes, I also encountered the same issue you described in your new GH issue. So, I don't think it's correct to say that timezones are supported in TF. Thanks, Ohad

hongbo-miao commented 1 week ago

@OhadSrur Oh I see what you mean. I initially thought when this post opened, timezone is not supported at all.

Closed https://github.com/airbytehq/terraform-provider-airbyte/issues/121 and copied my post here:


Case 1 (UTC)

When I run terraform apply for code

resource "airbyte_connection" "my_airbyte_connection" {
  # ...
  schedule = {
    schedule_type   = "cron"
    cron_expression = "0 27 * * * ? * UTC"
  }
}

it will create the schedule successfully.

Case 2 (US/Pacific)

When I run terraform apply for code

resource "airbyte_connection" "my_airbyte_connection" {
  # ...
  schedule = {
    schedule_type   = "cron"
    cron_expression = "0 27 * * * ? * US/Pacific"
  }
}
╷
│ Error: failure to invoke API
│
│   with module.horizon_airbyte_connection_snowflake_production_horizon_airbyte_db_data_engineering_jira.airbyte_connection.horizon_airbyte_connection,
│   on ../../../modules/airbyte/horizon_airbyte_connection/main.tf line 10, in resource "airbyte_connection" "horizon_airbyte_connection":
│   10: resource "airbyte_connection" "horizon_airbyte_connection" {
│
│ unknown status code returned: Status 400
│ {"status":400,"type":"https://reference.airbyte.com/reference/errors#bad-request","title":"bad-request","detail":"The request could not be understood by the server due to malformed
│ syntax.","documentationUrl":null,"data":{"message":"The cron expression 0 27 * * * ? * US/Pacific is not valid. Error: Cron expression contains 8 parts but we expect one of [6, 7]. Please check the cron
│ expression format at https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html"}}

Workaround Solution

Update in the Airbyte UI to use 0 27 * * * ? * and timezone US/Pacific

image

and run terraform apply again, it will show

No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.