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

Import of an auth0_resource_server_scopes unable to use existing scopes due to reorder #1062

Open
6 tasks done
jacobkretz-bf opened this issue Oct 28, 2024 · 1 comment
Open
6 tasks done
Labels
🪲 bug Something isn't working

Comments

@jacobkretz-bf
Copy link

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have upgraded to the latest version of this provider and the issue still persists.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

I'm trying to import auth0_resource_server_scopes resource and it appears that the resources is alphabetizing the scopes which leads to it want to delete all the scopes and recreate them. This would break any clients and may break association resources as the underlying ids would like change.

Expectation

Scopes should not be recreated on import if they already exist on the resource server.

Reproduction

~ resource "auth0_resource_server_scopes" "scopes" {
id = "foo"
resource_server_identifier = "foo"

  - scopes {
      - description = "b description" -> null
      - name        = "b" -> null
    }
  - scopes {
      - description = "a description" -> null
      - name        = "a" -> null
    }
  + scopes {
      + description = "a description"
      + name        = "a"
    }
  + scopes {
      + description = "b description"
      + name        = "b"
    }

Auth0 Terraform Provider version

1.7.1

Terraform version

1.7.3

@jacobkretz-bf jacobkretz-bf added the 🪲 bug Something isn't working label Oct 28, 2024
@jacobkretz-bf
Copy link
Author

For those that find this ticket. Here is the path to successfully import the scopes into the auth0_resoruce_server_scopes resource.

  1. Import each of the scopes using the auth0_resource_server_scope resource first. This is clearly doing something within Auth0 to add additional metadata on the scopes to enable the auth0_resource_server_scopes to behave appropriately.
  2. After you apply the import from 1. Import the scopes into the auth0_resource_service_scopes resource. In you plan you should see a successful import. The trick is what to do with the newly imported auth0_resource_service_scope resources you imported in step1. You can either use a removed block or you can manually remove them from the state file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant