Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import resources #645

Closed
grasskode opened this issue Sep 9, 2024 · 6 comments
Closed

Cannot import resources #645

grasskode opened this issue Sep 9, 2024 · 6 comments
Labels
kind/question Questions about existing features resolution/fixed This issue was fixed

Comments

@grasskode
Copy link

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: [email protected]

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).

@grasskode grasskode added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Sep 9, 2024
@VenelinMartinov
Copy link
Contributor

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: auth0/terraform-provider-auth0#1023

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

@VenelinMartinov VenelinMartinov added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). blocked The issue cannot be resolved without 3rd party action. and removed needs-triage Needs attention from the triage team labels Sep 11, 2024
@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Sep 16, 2024

Hey @grasskode, I got a response on auth0/terraform-provider-auth0#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?

@grasskode
Copy link
Author

@VenelinMartinov I can see that the domain is set in the stack's config as auth0:domain. This is how we were configuring it for v2. Has that changed in v3?

@VenelinMartinov
Copy link
Contributor

It should work, can you try configuring it via the environment variable and seeing if that works?

@VenelinMartinov VenelinMartinov added the awaiting-feedback Blocked on input from the author label Oct 4, 2024
@grasskode
Copy link
Author

@VenelinMartinov
Apologies for the long delay. I couldn't loop back sooner.

The issue was exactly as you mentioned. I was looking at the wrong branch. The imports were failing because the auth0:domain was changed to a different key. Fixing that fixed the issue. 🙏

@pulumi-bot pulumi-bot added needs-triage Needs attention from the triage team and removed awaiting-feedback Blocked on input from the author labels Oct 9, 2024
@VenelinMartinov
Copy link
Contributor

Glad to hear it worked @grasskode!

@VenelinMartinov VenelinMartinov added kind/question Questions about existing features resolution/fixed This issue was fixed and removed needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). blocked The issue cannot be resolved without 3rd party action. labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Questions about existing features resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants