Skip to content

Commit

Permalink
Fix Include auth0_client_credentials in Terraform generate command ou…
Browse files Browse the repository at this point in the history
…tput (#1032)

include auth0_client_credentials in auth0_import.tf generation
  • Loading branch information
developerkunal authored Jun 27, 2024
1 parent f587952 commit 0181f8d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/cli/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (i *terraformInputs) parseResourceFetchers(api *auth0.API) ([]resourceDataF
fetchers = append(fetchers, &attackProtectionResourceFetcher{})
case "auth0_branding":
fetchers = append(fetchers, &brandingResourceFetcher{})
case "auth0_client":
case "auth0_client", "auth0_client_credentials":
fetchers = append(fetchers, &clientResourceFetcher{api})
case "auth0_client_grant":
fetchers = append(fetchers, &clientGrantResourceFetcher{api})
Expand Down
5 changes: 5 additions & 0 deletions internal/cli/terraform_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ func (f *clientResourceFetcher) FetchData(ctx context.Context) (importDataList,
ResourceName: "auth0_client." + sanitizeResourceName(client.GetName()),
ImportID: client.GetClientID(),
})

data = append(data, importDataItem{
ResourceName: "auth0_client_credentials." + sanitizeResourceName(client.GetName()),
ImportID: client.GetClientID(),
})
}

if !clients.HasNext() {
Expand Down
16 changes: 16 additions & 0 deletions internal/cli/terraform_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,34 @@ func TestClientResourceFetcher_FetchData(t *testing.T) {
ResourceName: "auth0_client.my_test_client_1",
ImportID: "clientID_1",
},
{
ResourceName: "auth0_client_credentials.my_test_client_1",
ImportID: "clientID_1",
},
{
ResourceName: "auth0_client.my_test_client_2",
ImportID: "clientID_2",
},
{
ResourceName: "auth0_client_credentials.my_test_client_2",
ImportID: "clientID_2",
},
{
ResourceName: "auth0_client.my_test_client_3",
ImportID: "clientID_3",
},
{
ResourceName: "auth0_client_credentials.my_test_client_3",
ImportID: "clientID_3",
},
{
ResourceName: "auth0_client.my_test_client_4",
ImportID: "clientID_4",
},
{
ResourceName: "auth0_client_credentials.my_test_client_4",
ImportID: "clientID_4",
},
}

data, err := fetcher.FetchData(context.Background())
Expand Down

0 comments on commit 0181f8d

Please sign in to comment.