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

Unable to import application_role #108

Open
epbensimpson opened this issue Jan 17, 2022 · 4 comments
Open

Unable to import application_role #108

epbensimpson opened this issue Jan 17, 2022 · 4 comments

Comments

@epbensimpson
Copy link
Contributor

Seems like it's currently not possible to terraform import an application_role, it gives an error even when the role definitely exists for the specified application. I believe this is due to the fact it's using ImportStatePassthroughContext but relies on the application_id to retrieve the roles.

Per the documentation, for the passthrough function to work the read method must be able to load the resource using only data.Id(). Because the read method is relying on application_id, it doesn't work. Seems like a custom import function is required to support this properly?

I assume the same issue applies to entity_type_permission which is where the read function appears to have been copied from, but I haven't tested that.

@MCBrandenburg
Copy link
Contributor

Thank you for posting this, I'm going to work on this as soon as I get the provider caught up with the FusionAuth documentation.

@cdchurchill
Copy link

I seem to have hit the same problem using terraform import fusionauth_entity_type_permission, so confirming what was previously reported.

@Aaron-Ritter
Copy link

Hi,

I was trying the same today with an existing application and application role, and face the same issue.

root@terraform:~/identity# terraform import fusionauth_application_role.myapp-one-user 8c1265e4-f67b-4bd9-9724-bd4eb9032253
fusionauth_application_role.myapp-one-user: Importing from ID "8c1265e4-f67b-4bd9-9724-bd4eb9032253"...
fusionauth_application_role.myapp-one-user: Import prepared!
  Prepared fusionauth_application_role for import
fusionauth_application_role.myapp-one-user: Refreshing state... [id=8c1265e4-f67b-4bd9-9724-bd4eb9032253]
╷
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to "fusionauth_application_role.myapp-one-user", the provider detected that no object exists with the given id. Only pre-existing objects can be imported;
│ check that the id is correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.
╵

@andersjanssonmontel
Copy link

Seems like it's currently not possible to terraform import an application_role, it gives an error even when the role definitely exists for the specified application. I believe this is due to the fact it's using ImportStatePassthroughContext but relies on the application_id to retrieve the roles.

Per the documentation, for the passthrough function to work the read method must be able to load the resource using only data.Id(). Because the read method is relying on application_id, it doesn't work. Seems like a custom import function is required to support this properly?

I assume the same issue applies to entity_type_permission which is where the read function appears to have been copied from, but I haven't tested that.

This issue still remains, and can confirm the same issue applies to entity_type_permission.

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

No branches or pull requests

5 participants