Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: resource address "azuread_application_api_access.add-api-permission[0]" does not exist in the configuration. #1457

Open
srawatage opened this issue Aug 24, 2024 · 1 comment

Comments

@srawatage
Copy link

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

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@nbaju1
Copy link

nbaju1 commented Aug 27, 2024

Please provide an example of the Terraform configuration you are using. Much easier to understand your problem and help you if you provide that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants