Grafana contact point using terraform broken when using variable for token

I am using terraform to provision alerts. One of the contact points, is the slack contact point. Since I didn’t wanted to check-in the token into my github repo, I had used a variable for the token. This contact point is used in a notification policy.
Whenever I update my alerts, then plan wants to delete the slack portion of the contact point and recreate. The deletion fails because it is being referenced in a notification policy.
If I replace the variable for the token and use the direct string, then it works. Can you please let me know if I am missing something. Thanks.

I hope you used correct syntax for env variable in TF:

Anyway you can ignore token changes (as work around):

lifecycle {
   ignore_changes = [
    token
  ]
}

that’s not true, this is invalid syntax

Of course, that’s just snippet, not whole TF code.

not it is not, it is not a code at all

since “slack” object has no argument, nested block, or exported attribute named

This “snippet” would never work

Are you sure? I see it Terraform Registry

yes I am sure you will get the error when trying to approach this issue with

lifecycle {
    ignore_changes = [
      token
    ]
  }

or

lifecycle {
    ignore_changes = [
      slack.token
    ]
  }

It’s weird you suggest the code you never tried

It’s not weird. This is community forum, not paid support. I don’t have any legal obligation or responsibility here :-D. I would prefer to give a quick clue (so yes, they may not work, there can be syntax issues, …), instead of copy&paste solutions. Feel free to spend your time and provide tested code here - I will be happy to mark it as solution here.

you don’t make much sense, as well as your non-working code

please don’t mislead other people