rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
263 stars 228 forks source link

[BUG] ignore_changes does not work #1164

Open papanito opened 1 year ago

papanito commented 1 year ago

Rancher Server Setup

Information about the Cluster

git-ival commented 1 year ago

@papanito Can you please review the discussion in https://github.com/rancher/terraform-provider-rancher2/pull/1117 and try the suggested workaround on the latest version of the provider and verify if this is sufficient for your usecase? Thanks

papanito commented 1 year ago

The recommended workaround at https://github.com/rancher/rancher/issues/12821#issuecomment-391381651 or https://github.com/rancher/rancher/issues/12821#issuecomment-516421250 respectively, seems to work for us. So basically we add a placeholder

    annotations = {
      "metallb.universe.tf/ip-allocated-from-pool" = "placeholder"
      "field.cattle.io/publicEndpoints" = "placeholder"
    }

then, ignore_changes works

  lifecycle {
    prevent_destroy = true 
    ignore_changes = [
      metadata[0].annotations["field.cattle.io/publicEndpoints"],
      metadata[0].annotations["metallb.universe.tf/ip-allocated-from-pool"]  
    ]
  }