airbytehq / terraform-provider-airbyte

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

Cannot terraform a Notion source using a start_date with zero fractional seconds #52

Open chandlerprall opened 11 months ago

chandlerprall commented 11 months ago

Notion's start_date parameter is validated by validators.IsRFC3339(), allowing the fractional seconds representation (.###) to be omitted. When configuring a Notion resource via _airbyte_sourcenotion , if I specify the start date in any format with zero fractional seconds,

2023-01-01T00:00:00.000Z (explicit 0 fractional seconds) 2023-01-01T00:00:00Z (no fractional seconds)

the API request errors with

│ {"type":"https://reference.airbyte.com/reference/errors#unprocessable-entity","title":"unprocessable-entity","status":422,"detail":"The
│ provided configuration does not fulfill the specification. Errors: json schema validation failed when comparing the data to
│ the json schema. \nErrors: $.start_date: does not match the regex pattern
│ ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z$ "}

In the case of explicit 0 seconds, whatever is processing/formatting data for the request is dropping the fractional seconds:

terraform plan

  # airbyte_source_notion.notion will be created
  + resource "airbyte_source_notion" "notion" {
      + configuration = {
          + credentials = {
              + source_notion_authenticate_using_access_token = {
                  + auth_type = "token"
                  + token     = (sensitive value)
                }
            }
          + source_type = "notion"
          + start_date  = "2023-01-01T00:00:00.000Z"
        }
      + name          = "My Notion Source"
      + source_id     = (known after apply)
      + source_type   = (known after apply)
      + workspace_id  = (sensitive value)
    }

request body

{
  "configuration": {
    "credentials": {
      "auth_type": "token",
      "token": "..."
    },
    "sourceType": "notion",
    "start_date": "2023-01-01T00:00:00Z"
  },
  "name": "My Notion Source",
  "workspaceId": "..."
}

Specifying any other valid value of fractional seconds has worked for me. Likely worth noting the UI for creation a Notion source requires the fractional seconds, even when it's all 0s.

LouisAuneau commented 7 months ago

Having the same issue with Aircall source using provider 0.4.1.

ismaelhamed commented 7 months ago

Same with S3 source using provider 0.4.1