IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
341 stars 666 forks source link

User addition Resource trigger in every change of terraform. #4786

Open Iamrahul11 opened 1 year ago

Iamrahul11 commented 1 year ago

Community Note

Question

We have a resource named ibm_iam_user_invite, and it consistently requires recreation every time we make any new changes. This particular code in Terraform is consistently recreated whenever we perform any Terraform actions. Upon inspecting the list of users present in both the Terraform state and IBM Cloud IAM, it's evident that these users already exist. However, it remains unclear why this resource consistently prompts for recreation. Please help..and let me know what is needed form our side to look into this issue.

New or Affected Resource(s) or Datasource(s)

Potential Terraform Configuration

Terraform will perform the following actions:
  # ibm_iam_user_invite.users[0] will be created
  + resource "ibm_iam_user_invite" "users" {
      + id                      = (known after apply)
      + invited_users           = (known after apply)
      + number_of_invited_users = (known after apply)
      + users                   = [
          + "Barry.Mulvany1@ibm.com",
          + "Jeffrey.Matey1@ibm.com",
          + "Manish.Kumar23@ibm.com",
          + "Mohammed.S.Islam@ibm.com",
          + "Nathaniel.Blaboe@ibm.com",
          + "Sourav.Bose1@ibm.com",
          + "Walied.Elnaim@ibm.com",
          + "cathaldi@ie.ibm.com",
          + "nilesh_patel@ie.ibm.com",
          + "samuel.osobu@ibm.com",
          + "vincent.deshoulieres@ie.ibm.com",
        ]
    }
Iamrahul11 commented 1 year ago

Every time terragrunt refresh state files (e.g. pulls changes from IBM Cloud API and update state files accordingly). It gets:

  # ibm_iam_user_invite.users[0] has been deleted
  - resource "ibm_iam_user_invite" "users" {

So, it deletes the state file and recreate next run.