I'm trying to import IBM Cloud users, previously created with terraform, into a new state file after the old one was accidentally deleted!
In our tf file we have the resource:
resource "ibm_iam_user_invite" "account_users" {
users = var.account_users
}
In our variables.tf file we have the variable:
variable "account_users" {
type = list(string)
description = "List of all the current users with access to the IBM Cloud account"
}
And in our terraform.tfvars we have:
account_users = [
"user1@domain.com",
"user2@domain.com",
"user3@domain.com",
...
...
]
I can import a single user successfully using this command:
terraform import 'ibm_iam_user_invite.account_users' user1@domain.com
But when I try and import more users I get an error saying
Error: Resource already managed by Terraform
Terraform is already managing a remote object for ibm_iam_user_invite.account_users. To import to this address you must first remove the existing object from the state.
How do I correctly import the users?