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

Fix Include auth0_client_credentials in Terraform generate command output #1032

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading