fivetran / terraform-provider-fivetran

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

fivetran_webhook triggers update when there are no changes and creates an error #239

Closed adrian-montero-hkkd closed 6 months ago

adrian-montero-hkkd commented 6 months ago

Describe the bug The first time running a webhook creation it succeeds, but if you run a second apply in tf cloud with no changes to the resource, sometimes it will fail. When it fails, the second time it shows a change/update in the secret, although it was not changed: image

If I delete the webhook via fivetran rest api and manually remove the resource from the tf state using tf state rm, and trigger a new run, all the time it works the first time.

My guess is that when the provider queries the webhook to check current state it returns: "secret": "**", and that doesn't match the actual secret string in the terraform file and triggers the update condition.

To Reproduce

resource "fivetran_webhook" "tf_webhook_prod" {
  type = "group"
  group_id = fivetran_group.fivetran_group.id
  url = "https://myurl.site.com"
  active = true
  events = [
    "sync_start",
    "sync_end",
    "create_connector",
    "pause_connector",
    "resume_connector",
    "delete_connector",
    "connection_successful",
    "connection_failure"
    ]
  secret = "<redacted>"
}

Expected behavior If there are no changes in the webhook do not trigger an update.

Plugin version: 1.1.5

beevital commented 6 months ago

@adrian-montero-hkkd Fix included in latest version v1.1.11 If the fix doesn't work for you feel free to re-open the issue.

adrian-montero-hkkd commented 5 months ago

@beevital It seems the issue is reappearing, I had over 200+ webhooks setup and did no change to them and now all the webhooks show as "update" in plan although I did not change anything on them. So in the plan I get all the webhooks with this change: image And later get this result in the apply: image After I apply the plan and re-run a plan-apply cycle with no changes I get yet again this in the plan: image Just like if in the previous cycle that attribute was not changed in the webhook.