Skip to content

Commit

Permalink
pulumi#237 - Inject user connection name to allow resource import
Browse files Browse the repository at this point in the history
  • Loading branch information
bclayer4 committed Mar 7, 2024
1 parent a17e67b commit b01182a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
11 changes: 2 additions & 9 deletions patches/0001-Add-a-shim.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
From faa437a52d74af80d5c0960a92866a8d95d62da2 Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mikhail Shilkov <[email protected]>
Date: Tue, 19 Sep 2023 17:21:23 +0200
Subject: [PATCH 1/2] Add a shim
Subject: [PATCH 1/3] Add a shim

---
shim/shim.go | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 shim/shim.go

diff --git a/shim/shim.go b/shim/shim.go
new file mode 100644
Expand All @@ -24,6 +20,3 @@ index 00000000..3c127eb3
+func NewProvider() *schema.Provider {
+ return provider.New()
+}
--
2.39.3 (Apple Git-145)

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
From 674eeedaf4dd11c5936c347d2edc766f7256c58f Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thomas Kappler <[email protected]>
Date: Fri, 29 Sep 2023 07:52:53 +0200
Subject: [PATCH 2/2] Patch to avoid upstream ResourceServer panic: code moved
Subject: [PATCH 2/3] Patch to avoid upstream ResourceServer panic: code moved

---
internal/auth0/resourceserver/expand.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/internal/auth0/resourceserver/expand.go b/internal/auth0/resourceserver/expand.go
index ee1e6e97..5b1c23fa 100644
Expand All @@ -19,6 +16,3 @@ index ee1e6e97..5b1c23fa 100644
+ name := state.GetAttr("name")
+ return !name.IsNull() && name.AsString() == auth0ManagementAPIName
}
--
2.39.3 (Apple Git-145)

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fabrice Baumann <[email protected]>
Date: Thu, 7 Mar 2024 14:53:07 -0500
Subject: [PATCH 3/3] #237 - Inject user connection name to allow resource
import


diff --git a/internal/auth0/user/resource.go b/internal/auth0/user/resource.go
index bd9258ed..faddb005 100644
--- a/internal/auth0/user/resource.go
+++ b/internal/auth0/user/resource.go
@@ -175,6 +175,11 @@ func readUser(ctx context.Context, data *schema.ResourceData, meta interface{})
return diag.FromErr(internalError.HandleAPIError(data, err))
}

+ if len(user.Identities) == 1 {
+ userIdentity := user.Identities[0]
+ user.Connection = userIdentity.Connection
+ }
+
return diag.FromErr(flattenUser(data, user))
}

0 comments on commit b01182a

Please sign in to comment.