Skip to content

Commit 22726fb

Browse files
committed
update branding theme resource fetcher to use context
1 parent e1c013f commit 22726fb

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

internal/cli/terraform.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (i *terraformInputs) parseResourceFetchers(api *auth0.API) ([]resourceDataF
7474
case "auth0_branding":
7575
fetchers = append(fetchers, &brandingResourceFetcher{})
7676
case "auth0_branding_theme":
77-
fetchers = append(fetchers, &brandingThemeResourceFetcher{})
77+
fetchers = append(fetchers, &brandingThemeResourceFetcher{api})
7878
case "auth0_phone_provider":
7979
fetchers = append(fetchers, &phoneProviderResourceFetcher{api})
8080
case "auth0_client", "auth0_client_credentials":

internal/cli/terraform_fetcher.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,16 @@ func (f *brandingResourceFetcher) FetchData(_ context.Context) (importDataList,
143143
},
144144
}, nil
145145
}
146-
func (f *brandingThemeResourceFetcher) FetchData(_ context.Context) (importDataList, error) {
146+
func (f *brandingThemeResourceFetcher) FetchData(ctx context.Context) (importDataList, error) {
147147
var data importDataList
148148

149-
theme, err := f.api.BrandingTheme.Default(context.Background())
150-
if err != nil {
149+
theme, err := f.api.BrandingTheme.Default(ctx)
150+
if err != nil || theme == nil {
151151
return nil, err
152152
}
153153

154154
data = append(data, importDataItem{
155-
ResourceName: "auth0_branding_theme." + sanitizeResourceName(theme.GetDisplayName()),
155+
ResourceName: "auth0_branding_theme.default",
156156
ImportID: theme.GetID(),
157157
})
158158

internal/cli/terraform_fetcher_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ func TestBrandingThemeResourceFetcher_FetchData(t *testing.T) {
149149
brandingThemeAPI.EXPECT().
150150
Default(gomock.Any()).
151151
Return(&management.BrandingTheme{
152-
ID: auth0.String("theme_123"),
153-
DisplayName: auth0.String("My Theme"),
152+
ID: auth0.String("theme_123"),
154153
}, nil)
155154

156155
fetcher := brandingThemeResourceFetcher{
@@ -161,7 +160,7 @@ func TestBrandingThemeResourceFetcher_FetchData(t *testing.T) {
161160

162161
expectedData := importDataList{
163162
{
164-
ResourceName: "auth0_branding_theme.my_theme",
163+
ResourceName: "auth0_branding_theme.default",
165164
ImportID: "theme_123",
166165
},
167166
}

0 commit comments

Comments
 (0)