terraform-provider-auth0
terraform-provider-auth0 copied to clipboard
auth0_connection : import state error for google-oauth2
Checklist
- [X] I have looked into the README and have not found a suitable solution or answer.
- [X] I have looked into the documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have upgraded to the latest version of this provider and the issue still persists.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
$ terraform import auth0_connection.google_oauth2 XXXXXXXXXXXXXXXXX
auth0_connection.google_oauth2: Importing from ID "XXXXXXXXXXXXXXXXX"...
auth0_connection.google_oauth2: Import prepared!
Prepared auth0_connection for import
auth0_connection.google_oauth2: Refreshing state... [id=XXXXXXXXXXXXXXXXX]
╷
│ Error: decoding response payload failed: json: cannot unmarshal string into Go struct field ConnectionOptionsGoogleOAuth2.allowed_audiences of type []interface {}
│
│
╵
Expectation
Import the current state from google-oauth2 connection kind
Reproduction
- Configure a google-oauth2 connection with your own client_id and client_secret
- Try to import the state from terraform with:
terraform import auth0_connection.google_oauth2 XXXXXXXXXXXXXXXXX
Auth0 Terraform Provider version
0.37.0
Terraform version
1.2.6
Related to https://github.com/auth0/go-auth0/issues/14
Hey folks 👋🏻 , thanks for reporting this!
This is related to auth0/go-auth0#14 indeed. When the google oauth2 connection gets first created it will return the allowed_audiences
as an empty string instead of an empty array.
Not ideal, but until we fix this on the go auth0 SDK side or even better the API itself, a workaround would be to fill up the field in question in the UI with some dummy value, save, clear, save again. This will make it such that the API will return the field as an array afterwards and not fail any more when importing.
I'm running into this issue as of now after configuring non-dev Google API keys.
This issue doesn't exist in our alpha
tenant which still uses Auth0's default dev keys.
FYI: this also affects the new auth0_connection_client
resource
│ Error: failed to unmarshal response payload: json: cannot unmarshal string into Go struct field ConnectionOptionsGoogleOAuth2.allowed_audiences of type []string
│
│ with auth0_connection_client.app["google"],
│ on auth.tf line 63, in resource "auth0_connection_client" "app":
│ 63: resource "auth0_connection_client" "app" {
Hi,
Same issue here and it is quite important on our side. Any way we can help to solve this issue ?
+1
Hey folks 👋🏻
Apologies for the wait on this one, we were trying to push for a patch for this on the API side, but unfortunately that won't be possible so we're gonna have to work around this within the Go SDK that powers this provider (https://github.com/auth0/go-auth0). We're aiming at having this ready for the provider some time next week. I'll keep you updated in case of delays.
Thanks!
@sergiught Thanks for feedback!
Hey @sergiught any chance for release today?
Hey folks, appreciate everyone's patience with this one.
The fix is available now in the latest release v0.45.0. Please give it a go and let us know if you have any issues with it. Thanks!
Docs: https://registry.terraform.io/providers/auth0/auth0/0.45.0/docs
Thanks, it works!