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

Mismatch between arguments for auth0_client_grant #884

Closed
6 tasks done
peter-svensson opened this issue Nov 21, 2023 · 3 comments
Closed
6 tasks done

Mismatch between arguments for auth0_client_grant #884

peter-svensson opened this issue Nov 21, 2023 · 3 comments
Labels
🪲 bug Something isn't working

Comments

@peter-svensson
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

When creating a resource auth0_client_grant there seems to be a mismatch in the required configuration parameters and
the parameters actually passed to the Auth0 API.
The following config will result in errors when calling the API:

resource "auth0_client_grant" "spa" {
  client_id = auth0_client.spa.id
  audience  = auth0_resource_server.backend.identifier
  scopes    = []
}
module.auth0.auth0_client_grant.spa: Creating...
│ Error: 400 Bad Request: Payload validation error: 'Missing required property: scope'.
│
│   with module.auth0.auth0_client_grant.spa,
│   on ../modules/auth0/apis.tf line 10, in resource "auth0_client_grant" "spa":
│   10: resource "auth0_client_grant" "spa" {
│

And scope is not a valid configuration parameter for auth0_client_grant:

│ Error: Unsupported argument
│
│   on ../modules/auth0/apis.tf line 14, in resource "auth0_client_grant" "spa":
│   14:   scope    = []
│
│ An argument named "scope" is not expected here.
╵

Expectation

Either use scope or scopes (where scopes is probably the correct term) and make sure that the API call uses the correct argument (scope as described here

Reproduction

See description.

Auth0 Terraform Provider version

1.1.0

Terraform version

1.6.4

@ansraliant
Copy link

Can confirm it's happening on 1.1.0

Quick work around is to go back to 1.0.0 until this is fixed

@sergiught
Copy link
Contributor

Hello everyone 👋🏻,

Thank you for bringing this to our attention. The issue doesn't stem from a mismatch between the terraform config scopes and the API scope attribute. Occasionally, we enhance the developer experience by refining the naming conventions used in the API. Behind the scenes, the resource correctly maps and makes API calls.

The current issue arises because the Go SDK we utilize doesn't allow the transmission of scopes as an empty array. However, this issue has been addressed in auth0/go-auth0#318. As soon as this fix is released, we will incorporate it into the provider. In the meantime, kindly ensure that client grants with non-empty scopes are created.

Thank you for your understanding and patience.

willvedd added a commit that referenced this issue Nov 30, 2023
* Allow client grant scopes to be sent as an empty array

* Update to go-auth0 v1.3.1

* Updating changelog

---------

Co-authored-by: Ewan Harris <[email protected]>
Co-authored-by: Will Vedder <[email protected]>
@willvedd
Copy link
Contributor

Fixed with v1.1.1. Thank you for submitting this issue!

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

4 participants