segmentio / terraform-provider-segment

Terraform provider for Segment, using the Public API
https://registry.terraform.io/providers/segmentio/segment/latest
MIT License
27 stars 4 forks source link

`destination_subscription` resource not compatible with Reverse ETL mappings. #143

Closed gregoiredav closed 1 month ago

gregoiredav commented 1 month ago

Description

I believe that the destination_subscription resource does not work for reverse-etl destinations. My hunch is that it's because the state cannot hold a reverseETLSchedule key.

At the same time these fields are present on the Reverse ETL model (while I don't see any sync feature in the Segment UI for source models). So I humbly suspect a mixup.

To Reproduce

Just a simple import of the resource with terraform plan -generate-config-out=generated.tf, with an import block:

import {
  to = segment_reverse_etl_model.model
  id = "********"
}

This gives me the following error (I redacted my data).

│ Error: Unable to read Destination subscription
│
│ data failed to match schemas in anyOf(Config)
│ {
│   "data": {
│     "subscription": {
│       "id": "*******",
│       "name": "Upsert Firms",
│       "actionId": "tLbwUgCeC2qVhPm8ia7adn",
│       "actionSlug": "createUpdateObject",
│       "destinationId": "********",
│       "modelId": "*******",
│       "enabled": true,
│       "trigger": "event = \"new\"",
│       "settings": {
│         "id": {
│           "@template": "{{properties.firm_id}}"
│         },
│         "object_type_id": "124",
│         "custom_attributes": {
│           "name": {
│             "@template": "{{properties.name}}"
│           }
│         }
│       },
│       "reverseETLSchedule": {
│         "config": {
│           "spec": "0 11 * * *",
│           "timezone": "Europe/Paris"
│         },
│         "strategy": "CRON"
│       }
│     }
│   }
│ }
deanhuynh commented 1 month ago

This should be fixed now in v1.2.0. Please let me know if you still have any trouble.