pulumi / pulumi-auth0

An auth0Pulumi resource package, providing multi-language access to Auth0
Apache License 2.0
23 stars 7 forks source link

Cannot import resources #645

Open grasskode opened 1 week ago

grasskode commented 1 week ago

Describe what happened

While trying to import resources, either from the cli or the code, I get the following error:

error:   sdk-v2/provider2.go:385: sdk.helper_schema: failed to send the request: Get "https://api/v2/<resource>/<id>": Post "https:/oauth/token": http: no Host in request URL: provider=auth0@3.6.0

Seems suspicious that the v2 sdk is being invoked there.

Sample program

package main

import (
    "github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        googleOauth2Conn, err := auth0.NewConnection(ctx, "connections/google_oauth_2", &auth0.ConnectionArgs{
            Name:     pulumi.String(""),
            Strategy: pulumi.String("google-oauth2"),
            Options: &auth0.ConnectionOptionsArgs{
                ClientId:     pulumi.String("xxxxxxxxxxxxxx"),
                ClientSecret: pulumi.String("xxxxxxxxxxxxxxxx"),
                Scopes: pulumi.StringArray{
                    pulumi.String("email"),
                    pulumi.String("profile"),
                },
                SetUserRootAttributes: pulumi.String("on_each_login"),
            },
        }, pulumi.Import(pulumi.ID("xxxxxxxxxxxxx")), pulumi.Protect(true))
        if err != nil {
            return err
        }

        return nil
    })
}

Log output

error: Preview failed: refreshing urn:pulumi:staging::auth0::auth0:index/connection:Connection::auth0/connections/google_oauth_2: 1 error occurred:
    * failed to send the request: Get "https://api/v2/connections/xxxxxxxxxxxxxxx": Post "https:/oauth/token": http: no Host in request URL

Affected Resource(s)

No response

Output of pulumi about

CLI          
Version      3.131.0
Go Version   go1.23.0
Go Compiler  gc

Plugins
KIND      NAME   VERSION
resource  auth0  3.6.0
language  go     unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in go: executable='/usr/local/go/bin/go' version='go version go1.22.5 linux/amd64'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/karan
User           karan
Organizations  karan
Token type     personal

Dependencies:
NAME                                       VERSION
github.com/getsynq/cloud/lib/proto_parser  
github.com/pulumi/pulumi-auth0/sdk/v3      v3.6.0
github.com/pulumi/pulumi/sdk/v3            v3.130.0
github.com/samber/lo                       v1.47.0

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

VenelinMartinov commented 6 days ago

Hey @grasskode, thanks for reporting the issue here and sorry you've hit this.

The pulumi auth0 provider uses the terraform auth0 provider under the hood. This issue seems to be an issue with the terraform provider, which I've reported here: https://github.com/auth0/terraform-provider-auth0/issues/1023

As soon as that is addressed, we'll inherit the fix in the pulumi provider too.

VenelinMartinov commented 1 day ago

Hey @grasskode, I got a response on https://github.com/auth0/terraform-provider-auth0/issues/1023 from the Auth0 TF provider maintainers and the issue I had there was that I hadn't set up the AUTH0_DOMAIN environment variable which is required for the provider to use the correct URL.

Can you try setting that and see if it fixes your issue?