kelvintaywl / terraform-provider-circleci

(Unofficial) Terraform Provider for CircleCI
https://registry.terraform.io/providers/kelvintaywl/circleci/latest
Mozilla Public License 2.0
12 stars 3 forks source link

resource circleci_webhook shows events attribute changed on `terraform plan` even though there is no changes. #45

Closed nagendrasanthosh closed 1 year ago

nagendrasanthosh commented 1 year ago

terraform plan shows the circleci_webhook resource events have been changed .

subsequently terraform apply runs and the final state of webhook remains unchanged. ideally no changes should be reported by terraform plan. this can be misleading . please help us fix this issue

~ resource "circleci_webhook" "compass_webhook" {
      ~ events         = [
            "workflow-completed",
          - "workflow-completed",
        ]
        id             = "xxxxxxxxxxxxxxxxxxx"
        name           = "compass-webhook-notifications"
      ~ signing_secret = (sensitive value)
      ~ updated_at     = "2023-07-31T09:28:25.905Z" -> (known after apply)
        # (4 unchanged attributes hidden)
    }
kelvintaywl commented 1 year ago

hi @nagendrasanthosh

thanks for filing this issue! yes, indeed, i noted the events list reports changes during terraform plan even if the values did not change.

I will be making a PR to address this soon.

kelvintaywl commented 1 year ago

hi @nagendrasanthosh

I added fixes re: detecting changes on the circleci_webhook resource. 🤓 this is released as per v0.11.0. Specifically, for events, I've made it a Set , instead of List. Ref: https://registry.terraform.io/providers/kelvintaywl/circleci/latest/docs/resources/webhook#events

This way, it does not matter re: the order of the events' items, and thus should reflect no changes as expected when there is indeed no changes.

Can you try updating your use of this plugin to v0.11.0 and see if this fixes for you now? Thanks again! 🍻

terraform {
  required_providers {
    circleci = {
      source = "kelvintaywl/circleci"
      version = "0.11.0"
    }
  }
}

provider "circleci" {
  # Configuration options
}
nagendrasanthosh commented 1 year ago

@kelvintaywl The issue is fixed after upgrading to the latest version for the provider. Thanks for your time and help fixing it