I am getting an error when migrating while trying to apply the IAM Terraform configuration
When running the IBM® Cloud Logs migration tool version 0.1.26 using Terraform to apply the IBM Cloud® Identity and Access Management (IAM) configuration, an error is returned and the IAM configuration changes are not applied.
You get an error message similar to the following:
Error: Duplicate resource "ibm_iam_access_group_policy" configuration
on roles.tf line 46:
46: resource "ibm_iam_access_group_policy" "policy_1" {
A ibm_iam_access_group_policy resource named "policy_1" was already declared at roles.tf:35,1-50. Resource names must be unique per type in each module.
This error can result if the policy permissions were created previously using the UI or by running the migration tool using the API method.
Resolve this issue by one of the following methods:
-
Remove the existing policy permissions, for example, by using the UI if they were created using the UI, and apply the Terraform by running
terraform init
andterriform apply
. -
Edit the
roles.tf
file and changes the name of the duplicate policy to another name and apply the Terraform by runningterraform init
andterriform apply
. In the example message the policy name ispolicy_1
.