auth0_connection state fails to refresh (v0.8.1)
MorrisonCole opened this issue ยท 3 comments
Community Note
- Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
Terraform v0.12.24
+ provider.auth0 v0.8.1
Affected Resource(s)
- auth0_connection
Terraform Configuration Files
resource "auth0_connection" "google_oauth2" {
name = "google-oauth2"
strategy = "google-oauth2"
is_domain_connection = false
}
Debug Output
If you need this, please let me know and I'll provide a redacted version!
Panic Output
N/A
Expected Behavior
Terraform state should refresh regardless of the current state โป๏ธ
Actual Behavior
Auth0 provider crashed with:
Error: missing expected [
Error: json: cannot unmarshal string into Go struct field ConnectionOptionsGoogleOAuth2.allowed_audiences of type []inte
rface {}
Steps to Reproduce
- Import the default Auth0 Google connection resource (might fail here too, but not sure because we're seeing this after upgrading from
v0.5.1
and already had it imported). terraform plan
Important Factoids
This connection is provided/enabled by default by Auth0. We're using this configuration to explicitly disable it.
Response for this connection directly via the Auth0 Management API (sensitive info redacted):
{
"id": "CONNECTION_ID",
"options": {
"email": true,
"gmail": false,
"orkut": false,
"scope": [
"email",
"profile"
],
"sites": false,
"tasks": false,
"blogger": false,
"profile": true,
"youtube": false,
"calendar": false,
"contacts": false,
"analytics": false,
"client_id": "",
"moderator": false,
"coordinate": false,
"picasa_web": false,
"google_plus": false,
"google_books": false,
"google_drive": false,
"spreadsheets": false,
"client_secret": "",
"document_list": false,
"latitude_best": false,
"latitude_city": false,
"url_shortener": false,
"webmaster_tools": false,
"chrome_web_store": false,
"allowed_audiences": "",
"adsense_management": false,
"google_drive_files": false,
"coordinate_readonly": false,
"google_cloud_storage": false,
"content_api_for_shopping": false,
"google_affiliate_network": false
},
"strategy": "google-oauth2",
"name": "google-oauth2",
"is_domain_connection": false,
"enabled_clients": [],
"realms": [
"google-oauth2"
]
}
References
Hmm, it seems that the Auth0 API is sending allowed_audiences
as a string instead of an array. Probably the bug should be resolved in go-auth0/auth0.
I'll do some digging and let you know.
Okay, so a quick test shows me that if you leave the Allowed Mobile Client IDs (allowed_audiences) field empty upon creation, it will be sent as an empty string. This seems like a bug with the API to me, but I can look into handling it in the SDK if we can.
If you specify a dummy audience in that field it will do the right thing it seems.
This issue was moved by alexkappa to alexkappa/terraform-provider-auth0#198.