Context : I have App Registration A and App Registration B. A had role1 and role2. I want to assign role1 of A to B as requiredResourceAccess.
I am using azuread_application_api_access providing necessary inputs. When i did a terraform run to add role1 to give required resource access to B. It worked fine . when i ran second pileline to add both role1 and role2 to provide required api access to B. I am getting below error.
I could see terrraform uses object id and app id alone in resource . this is causing issue . becasue for same A and B these will be same . role id is unique identifier here.
Can you help here
Error : module.add-api-access-module[0].azuread_application_api_access.add-api-permission["780exxxxxx-709b-fxx46f22"]: Creating...
╷
│ Error: A resource with the ID "/applications/d0650550-8xxxxe3-bb2d6bfd546c/apiAccess/7970xxcd-1dc34efb6ec8" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azuread_application_api_access" for more information.
│
│ with module.add-api-access-module[0].azuread_application_api_access.add-api-permission["780e1xxxxx-709b-f1244b446f22"],
│ on ../acm-modules/api-access/access.tf line 31, in resource "azuread_application_api_access" "add-api-permission":
│ 31: resource "azuread_application_api_access" "add-api-permission" {
│
│ A resource with the ID
│ "/applications/d065055xxxxxb2d6bfd546c/apiAccess/79700e3d-a1bc-xxxfb6ec8"
│ already exists - to be managed via Terraform this resource needs to be
│ imported into the State. Please see the resource documentation for
│ "azuread_application_api_access" for more information.
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform (and AzureAD Provider) Version
Affected Resource(s)
azuread_XXXXX
Terraform Configuration Files
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
Context : I have App Registration A and App Registration B. A had role1 and role2. I want to assign role1 of A to B as requiredResourceAccess.
I am using azuread_application_api_access providing necessary inputs. When i did a terraform run to add role1 to give required resource access to B. It worked fine . when i ran second pileline to add both role1 and role2 to provide required api access to B. I am getting below error.
I could see terrraform uses object id and app id alone in resource . this is causing issue . becasue for same A and B these will be same . role id is unique identifier here.
Can you help here
Error : module.add-api-access-module[0].azuread_application_api_access.add-api-permission["780exxxxxx-709b-fxx46f22"]: Creating... ╷ │ Error: A resource with the ID "/applications/d0650550-8xxxxe3-bb2d6bfd546c/apiAccess/7970xxcd-1dc34efb6ec8" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azuread_application_api_access" for more information. │ │ with module.add-api-access-module[0].azuread_application_api_access.add-api-permission["780e1xxxxx-709b-f1244b446f22"], │ on ../acm-modules/api-access/access.tf line 31, in resource "azuread_application_api_access" "add-api-permission": │ 31: resource "azuread_application_api_access" "add-api-permission" { │ │ A resource with the ID │ "/applications/d065055xxxxxb2d6bfd546c/apiAccess/79700e3d-a1bc-xxxfb6ec8" │ already exists - to be managed via Terraform this resource needs to be │ imported into the State. Please see the resource documentation for │ "azuread_application_api_access" for more information.
Community Note
Terraform (and AzureAD Provider) Version
Affected Resource(s)
azuread_XXXXX
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
References
0000