fivetran / terraform-provider-fivetran

Terraform Provider for Fivetran
https://fivetran.com
Apache License 2.0
40 stars 24 forks source link

Cannot import existing connector schedule #170

Closed ghost closed 1 year ago

ghost commented 1 year ago

Cannot import existing connector schedule. Have tried for existing and new connectors, plus many permutation of what Fivetran could perceive as the connector IDs.

Either the data is not exposed via API, or the docs are misleading.

terraform import fivetran_connector_schedule.microsoft_ads_schedule "bingads"
fivetran_connector_schedule.microsoft_ads_schedule: Importing from ID "bingads"...
fivetran_connector_schedule.microsoft_ads_schedule: Import prepared!
  Prepared fivetran_connector_schedule for import
fivetran_connector_schedule.microsoft_ads_schedule: Refreshing state... [id=bingads]
╷
│ Error: Connector with id = doesn't exist.
│
│ status code: 405; expected: 200; code: Error; message: HTTP 405 Method Not Allowed

_Note: bingads is used in place of the actual connectorid for anonymity

beevital commented 1 year ago

@LGAnyVan you don't need to import this resource. If you already have an existing connector with id = my_connector_id just define fivetran_connector_schedule resource for it:

resource "fivetran_connector_schedule" "my_connector_schedule" {
    connector_id = "my_connector_id"

    sync_frequency     = "360"
    paused             = false
    pause_after_trial  = true
    schedule_type      = "auto"
}

Docs will be updated in next release.

beevital commented 1 year ago

To fetch schedule values from existing connector use fivetran_connector data source:

data "fivetran_connector" "my_connector" {
    id = "my_connector_id"
}

# now you can use schedule values from this data_source:
#   sync_frequency = data.fivetran_connector.my_connector.sync_frequency
#   paused = data.fivetran_connector.my_connector.paused
ghost commented 1 year ago

Thanks for showing how to get the values. I was able to reproduce what you said, but I would suggest refactoring, or making it clearer in documentation, as I would expect these values to be in the sync schedule resource that was recently introduced.