onelogin / terraform-provider-onelogin

GNU General Public License v3.0
27 stars 19 forks source link

SSO attributes are exported in a list #13

Closed mikkoc closed 4 years ago

mikkoc commented 4 years ago

I created an OIDC app and when trying to reference the client_id and secret, I get the following error:

     OIDC_Client_ID         = onelogin_oidc_apps.incident_response.sso.client_id
 Block type "sso" is represented by a list of objects, so it must be indexed
 using a numeric key, like .sso[0].

This is confirmed by a quick look in the state file, where SSO is a list:

            "sso": [
              {
                "client_id": "xxx",
                "client_secret": "xxx"
              }
            ],

I fixed it as Terraform recommended, but I'm wondering if this is meant to be: can there be more than one SSO objects? If so, perhaps the docs need updating.

dcaponi commented 4 years ago

To be perfectly honest, we are still learning how users use Terraform, so this is great feedback; thank you. I didn't know the distinction between type maps / type lists mattered as much, but I get how this seems pretty weird.

I'm pretty sure theres only ever going to be one SSO node on these. Let me confirm with the API team, and if everyone's in agreement, I can make this switch so SSO is a typeMap rather than a typeList.

I'll ping here once we decide on a go/no-go and what changes will come.

mikkoc commented 4 years ago

That's totally understandable, no rush. Thanks for looking into this.

dcaponi commented 4 years ago

Hey @mikkoc go ahead and update to v0.0.2rc3 which should have SSO (and configuration) as maps instead of lists. Let me know how you like it, hope this is closer to what you'd expect :)

mikkoc commented 4 years ago

Sorry I forgot to reply, thanks for this, looks good!