-
-
Notifications
You must be signed in to change notification settings - Fork 149
Conversation
@@ -44,6 +49,7 @@ func configure(data *schema.ResourceData) (interface{}, error) { | |||
domain := data.Get("domain").(string) | |||
id := data.Get("client_id").(string) | |||
secret := data.Get("client_secret").(string) | |||
debug := data.Get("debug").(bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is why the build fails, its defined as a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, sorry, this is just a draft yet ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've went ahead and pushed a new tag with your changes in yieldr/go-auth, so please feel free to update vendors.
You can do that with dep ensure -update github.com/yieldr/go-auth0
213a555
to
31a6e7f
Compare
"debug": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
DefaultFunc: func() (interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't just use schema.EnvDefaultFunc
here because it returns the variable value as a string, but we need bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we don't need to use env vars for this, and allow defining it only via the provider config (tf). For example to enable debug we could do:
provider "auth0" {
debug = "true"
}
I took this example from the aws provider, which only looks for certain env vars (that are usually defined in the host system) and for others you must configure it yourself. Example: https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/provider.go#L60-L76
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For aws, I think the core reason is that the provider just supports "well-known" environment variables, and no specific "provider" environment variables..
Personally, I think "debug" is more like a dynamic property than a static one. It would be convenient for me just using export TF_LOG=debug
and export AUTH0_DEBUG=true
if I want to debug auth0 requests temporary. If I would have to change tf file, I could end up accidentally committing this or something.
Still, if you don't think that it can be convenient, I can remove the support for environment variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I see your point in that it would be a nuisance to change it in the file. Lets keep it then with env vars and see how it goes ;)
Updated vendors, added code for processing "debug" property. |
Cannot check if this actually works right now, because we need to have updated vendored go-auth0 with this go-auth0/auth0#11.
So this is a WIP until vendors are updated.