From 1bdc4f1b6440af86f3e6c5f63d6ac3cc316ac0be Mon Sep 17 00:00:00 2001 From: Serge Smertin Date: Fri, 18 Feb 2022 16:42:48 +0100 Subject: [PATCH] Add screencast --- docs/guides/experimental-exporter.md | 6 +++++- exporter/importables.go | 23 ----------------------- exporter/importables_test.go | 26 -------------------------- 3 files changed, 5 insertions(+), 50 deletions(-) diff --git a/docs/guides/experimental-exporter.md b/docs/guides/experimental-exporter.md index 9dcdf82f22..1420b2b466 100644 --- a/docs/guides/experimental-exporter.md +++ b/docs/guides/experimental-exporter.md @@ -11,7 +11,11 @@ Generates `*.tf` files for Databricks resources as well as `import.sh` to run im ## Example Usage -After downloading the [latest released binary](https://github.com/databrickslabs/terraform-provider-databricks/releases), unpack it and place it in the same folder. In fact, you may have already downloaded this binary - check `.terraform` folder of any state directory, where you've used `databricks` provider. It could also be in your plugin cache `~/.terraform.d/plugins/registry.terraform.io/databrickslabs/databricks/*/*/terraform-provider-databricks`. +After downloading the [latest released binary](https://github.com/databrickslabs/terraform-provider-databricks/releases), unpack it and place it in the same folder. In fact, you may have already downloaded this binary - check `.terraform` folder of any state directory, where you've used `databricks` provider. It could also be in your plugin cache `~/.terraform.d/plugins/registry.terraform.io/databrickslabs/databricks/*/*/terraform-provider-databricks`. Here's the tool in action: + +[![asciicast](https://asciinema.org/a/Rv8ZFJQpfrfp6ggWddjtyXaOy.svg)](https://asciinema.org/a/Rv8ZFJQpfrfp6ggWddjtyXaOy) + +Exporter can also be used in a non-interactive mode: ```bash export DATABRICKS_HOST=... diff --git a/exporter/importables.go b/exporter/importables.go index 4d727e8168..c78ba46368 100644 --- a/exporter/importables.go +++ b/exporter/importables.go @@ -790,29 +790,6 @@ var resourcesMap map[string]importable = map[string]importable{ return nil }, }, - "databricks_git_credential": { - Service: "repos", - Name: func(d *schema.ResourceData) string { - return d.Get("git_provider").(string) + "_" + d.Get("git_username").(string) + "_" + d.Id() - }, - List: func(ic *importContext) error { - creds, err := repos.NewGitCredentialsAPI(ic.Context, ic.Client).List() - if err != nil { - return err - } - for offset, cred := range creds { - ic.Emit(&resource{ - Resource: "databricks_git_credential", - ID: fmt.Sprintf("%d", cred.ID), - }) - log.Printf("[INFO] Scanned %d of %d Git credentials", offset+1, len(creds)) - } - return nil - }, - Depends: []reference{ - {Path: "personal_access_token", Variable: true}, - }, - }, "databricks_workspace_conf": { Service: "workspace", Name: func(d *schema.ResourceData) string { diff --git a/exporter/importables_test.go b/exporter/importables_test.go index 85d799b51e..3b7dc2cd2b 100644 --- a/exporter/importables_test.go +++ b/exporter/importables_test.go @@ -606,32 +606,6 @@ func TestNotebookGeneration(t *testing.T) { }) } -func TestGitCredentialGen(t *testing.T) { - testGenerate(t, []qa.HTTPFixture{ - { - Method: "GET", - Resource: "/api/2.0/git-credentials/a", - Response: repos.GitCredentialResponse{ - UserName: "me", - Provider: "github", - }, - }, - }, "repos", func(ic *importContext) { - ic.Emit(&resource{ - Resource: "databricks_git_credential", - ID: "a", - }) - - ic.generateHclForResources(nil) - assert.Equal(t, internal.TrimLeadingWhitespace(` - resource "databricks_git_credential" "github_me_a" { - personal_access_token = var.personal_access_token_github_me_a - git_username = "me" - git_provider = "github" - }`), string(ic.Files["repos"].Bytes())) - }) -} - func TestGlobalInitScriptGen(t *testing.T) { testGenerate(t, []qa.HTTPFixture{ {