From 4c5b866deaf3ea78d09584d2381af3504e02fca8 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 17 May 2021 09:45:36 -0700 Subject: [PATCH] Move registry/ to internal/registry/ This is part of a general effort to move all of Terraform's non-library package surface under internal in order to reinforce that these are for internal use within Terraform only. If you were previously importing packages under this prefix into an external codebase, you could pin to an earlier release tag as an interim solution until you've make a plan to achieve the same functionality some other way. --- command/command_test.go | 21 +++++++++---------- command/meta_config.go | 2 +- configs/configload/loader.go | 2 +- configs/configload/module_mgr.go | 2 +- internal/initwd/from_module.go | 2 +- internal/initwd/from_module_test.go | 2 +- internal/initwd/getter.go | 2 +- internal/initwd/module_install.go | 6 +++--- internal/initwd/module_install_test.go | 2 +- internal/initwd/testing.go | 2 +- {registry => internal/registry}/client.go | 4 ++-- .../registry}/client_test.go | 4 ++-- {registry => internal/registry}/errors.go | 2 +- .../registry}/regsrc/friendly_host.go | 0 .../registry}/regsrc/friendly_host_test.go | 0 .../registry}/regsrc/module.go | 0 .../registry}/regsrc/module_test.go | 0 .../registry}/regsrc/regsrc.go | 0 .../registry}/response/module.go | 0 .../registry}/response/module_list.go | 0 .../registry}/response/module_provider.go | 0 .../registry}/response/module_versions.go | 0 .../registry}/response/pagination.go | 0 .../registry}/response/pagination_test.go | 0 .../registry}/response/redirect.go | 0 .../registry}/test/mock_registry.go | 4 ++-- terraform/terraform_test.go | 2 +- 27 files changed, 29 insertions(+), 30 deletions(-) rename {registry => internal/registry}/client.go (98%) rename {registry => internal/registry}/client_test.go (98%) rename {registry => internal/registry}/errors.go (95%) rename {registry => internal/registry}/regsrc/friendly_host.go (100%) rename {registry => internal/registry}/regsrc/friendly_host_test.go (100%) rename {registry => internal/registry}/regsrc/module.go (100%) rename {registry => internal/registry}/regsrc/module_test.go (100%) rename {registry => internal/registry}/regsrc/regsrc.go (100%) rename {registry => internal/registry}/response/module.go (100%) rename {registry => internal/registry}/response/module_list.go (100%) rename {registry => internal/registry}/response/module_provider.go (100%) rename {registry => internal/registry}/response/module_versions.go (100%) rename {registry => internal/registry}/response/pagination.go (100%) rename {registry => internal/registry}/response/pagination_test.go (100%) rename {registry => internal/registry}/response/redirect.go (100%) rename {registry => internal/registry}/test/mock_registry.go (98%) diff --git a/command/command_test.go b/command/command_test.go index 935350433..1301ed4f4 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -18,18 +18,22 @@ import ( "testing" svchost "github.com/hashicorp/terraform-svchost" - "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/command/views" - "github.com/hashicorp/terraform/internal/getproviders" - "github.com/hashicorp/terraform/internal/initwd" - "github.com/hashicorp/terraform/internal/terminal" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform-svchost/disco" "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform/command/views" "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs/configload" "github.com/hashicorp/terraform/configs/configschema" + backendInit "github.com/hashicorp/terraform/internal/backend/init" + backendLocal "github.com/hashicorp/terraform/internal/backend/local" "github.com/hashicorp/terraform/internal/copy" + "github.com/hashicorp/terraform/internal/getproviders" + "github.com/hashicorp/terraform/internal/initwd" + legacy "github.com/hashicorp/terraform/internal/legacy/terraform" + _ "github.com/hashicorp/terraform/internal/logging" + "github.com/hashicorp/terraform/internal/registry" + "github.com/hashicorp/terraform/internal/terminal" "github.com/hashicorp/terraform/plans" "github.com/hashicorp/terraform/plans/planfile" "github.com/hashicorp/terraform/providers" @@ -39,11 +43,6 @@ import ( "github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/version" "github.com/zclconf/go-cty/cty" - - backendInit "github.com/hashicorp/terraform/internal/backend/init" - backendLocal "github.com/hashicorp/terraform/internal/backend/local" - legacy "github.com/hashicorp/terraform/internal/legacy/terraform" - _ "github.com/hashicorp/terraform/internal/logging" ) // These are the directories for our test data and fixtures. diff --git a/command/meta_config.go b/command/meta_config.go index 51ca27447..9ebe892a5 100644 --- a/command/meta_config.go +++ b/command/meta_config.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/internal/earlyconfig" "github.com/hashicorp/terraform/internal/initwd" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform/internal/registry" "github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/tfdiags" "github.com/zclconf/go-cty/cty" diff --git a/configs/configload/loader.go b/configs/configload/loader.go index a09b80c8c..9c3ec3ee7 100644 --- a/configs/configload/loader.go +++ b/configs/configload/loader.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-svchost/disco" "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform/internal/registry" "github.com/spf13/afero" ) diff --git a/configs/configload/module_mgr.go b/configs/configload/module_mgr.go index cf930f537..bf8d067e6 100644 --- a/configs/configload/module_mgr.go +++ b/configs/configload/module_mgr.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-svchost/disco" "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform/internal/registry" "github.com/spf13/afero" ) diff --git a/internal/initwd/from_module.go b/internal/initwd/from_module.go index f6c0d0b17..14e5a124e 100644 --- a/internal/initwd/from_module.go +++ b/internal/initwd/from_module.go @@ -15,7 +15,7 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-config-inspect/tfconfig" "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform/internal/registry" "github.com/hashicorp/terraform/tfdiags" ) diff --git a/internal/initwd/from_module_test.go b/internal/initwd/from_module_test.go index c9ac25afc..f7e07fb4d 100644 --- a/internal/initwd/from_module_test.go +++ b/internal/initwd/from_module_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs/configload" "github.com/hashicorp/terraform/internal/copy" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform/internal/registry" "github.com/hashicorp/terraform/tfdiags" ) diff --git a/internal/initwd/getter.go b/internal/initwd/getter.go index d7d9c2f2a..a41e047aa 100644 --- a/internal/initwd/getter.go +++ b/internal/initwd/getter.go @@ -10,7 +10,7 @@ import ( cleanhttp "github.com/hashicorp/go-cleanhttp" getter "github.com/hashicorp/go-getter" "github.com/hashicorp/terraform/internal/copy" - "github.com/hashicorp/terraform/registry/regsrc" + "github.com/hashicorp/terraform/internal/registry/regsrc" ) // We configure our own go-getter detector and getter sets here, because diff --git a/internal/initwd/module_install.go b/internal/initwd/module_install.go index 38a44c262..f97bea781 100644 --- a/internal/initwd/module_install.go +++ b/internal/initwd/module_install.go @@ -12,9 +12,9 @@ import ( "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/internal/earlyconfig" "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/registry" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/response" + "github.com/hashicorp/terraform/internal/registry" + "github.com/hashicorp/terraform/internal/registry/regsrc" + "github.com/hashicorp/terraform/internal/registry/response" "github.com/hashicorp/terraform/tfdiags" ) diff --git a/internal/initwd/module_install_test.go b/internal/initwd/module_install_test.go index 2b7f18674..64381db7a 100644 --- a/internal/initwd/module_install_test.go +++ b/internal/initwd/module_install_test.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs/configload" "github.com/hashicorp/terraform/internal/copy" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform/internal/registry" "github.com/hashicorp/terraform/tfdiags" _ "github.com/hashicorp/terraform/internal/logging" diff --git a/internal/initwd/testing.go b/internal/initwd/testing.go index 8cef80a35..0f593becd 100644 --- a/internal/initwd/testing.go +++ b/internal/initwd/testing.go @@ -1,11 +1,11 @@ package initwd import ( - "github.com/hashicorp/terraform/registry" "testing" "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs/configload" + "github.com/hashicorp/terraform/internal/registry" "github.com/hashicorp/terraform/tfdiags" ) diff --git a/registry/client.go b/internal/registry/client.go similarity index 98% rename from registry/client.go rename to internal/registry/client.go index 03e6f7c96..7a87078ed 100644 --- a/registry/client.go +++ b/internal/registry/client.go @@ -18,8 +18,8 @@ import ( "github.com/hashicorp/terraform-svchost/disco" "github.com/hashicorp/terraform/httpclient" "github.com/hashicorp/terraform/internal/logging" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/response" + "github.com/hashicorp/terraform/internal/registry/regsrc" + "github.com/hashicorp/terraform/internal/registry/response" "github.com/hashicorp/terraform/version" ) diff --git a/registry/client_test.go b/internal/registry/client_test.go similarity index 98% rename from registry/client_test.go rename to internal/registry/client_test.go index ad5270fa1..1122e6164 100644 --- a/registry/client_test.go +++ b/internal/registry/client_test.go @@ -11,8 +11,8 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-svchost/disco" "github.com/hashicorp/terraform/httpclient" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/test" + "github.com/hashicorp/terraform/internal/registry/regsrc" + "github.com/hashicorp/terraform/internal/registry/test" tfversion "github.com/hashicorp/terraform/version" ) diff --git a/registry/errors.go b/internal/registry/errors.go similarity index 95% rename from registry/errors.go rename to internal/registry/errors.go index 5ae022fd2..a35eb717e 100644 --- a/registry/errors.go +++ b/internal/registry/errors.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/registry/regsrc" + "github.com/hashicorp/terraform/internal/registry/regsrc" ) type errModuleNotFound struct { diff --git a/registry/regsrc/friendly_host.go b/internal/registry/regsrc/friendly_host.go similarity index 100% rename from registry/regsrc/friendly_host.go rename to internal/registry/regsrc/friendly_host.go diff --git a/registry/regsrc/friendly_host_test.go b/internal/registry/regsrc/friendly_host_test.go similarity index 100% rename from registry/regsrc/friendly_host_test.go rename to internal/registry/regsrc/friendly_host_test.go diff --git a/registry/regsrc/module.go b/internal/registry/regsrc/module.go similarity index 100% rename from registry/regsrc/module.go rename to internal/registry/regsrc/module.go diff --git a/registry/regsrc/module_test.go b/internal/registry/regsrc/module_test.go similarity index 100% rename from registry/regsrc/module_test.go rename to internal/registry/regsrc/module_test.go diff --git a/registry/regsrc/regsrc.go b/internal/registry/regsrc/regsrc.go similarity index 100% rename from registry/regsrc/regsrc.go rename to internal/registry/regsrc/regsrc.go diff --git a/registry/response/module.go b/internal/registry/response/module.go similarity index 100% rename from registry/response/module.go rename to internal/registry/response/module.go diff --git a/registry/response/module_list.go b/internal/registry/response/module_list.go similarity index 100% rename from registry/response/module_list.go rename to internal/registry/response/module_list.go diff --git a/registry/response/module_provider.go b/internal/registry/response/module_provider.go similarity index 100% rename from registry/response/module_provider.go rename to internal/registry/response/module_provider.go diff --git a/registry/response/module_versions.go b/internal/registry/response/module_versions.go similarity index 100% rename from registry/response/module_versions.go rename to internal/registry/response/module_versions.go diff --git a/registry/response/pagination.go b/internal/registry/response/pagination.go similarity index 100% rename from registry/response/pagination.go rename to internal/registry/response/pagination.go diff --git a/registry/response/pagination_test.go b/internal/registry/response/pagination_test.go similarity index 100% rename from registry/response/pagination_test.go rename to internal/registry/response/pagination_test.go diff --git a/registry/response/redirect.go b/internal/registry/response/redirect.go similarity index 100% rename from registry/response/redirect.go rename to internal/registry/response/redirect.go diff --git a/registry/test/mock_registry.go b/internal/registry/test/mock_registry.go similarity index 98% rename from registry/test/mock_registry.go rename to internal/registry/test/mock_registry.go index 00ead006e..2d590c4d1 100644 --- a/registry/test/mock_registry.go +++ b/internal/registry/test/mock_registry.go @@ -14,8 +14,8 @@ import ( "github.com/hashicorp/terraform-svchost/auth" "github.com/hashicorp/terraform-svchost/disco" "github.com/hashicorp/terraform/httpclient" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/response" + "github.com/hashicorp/terraform/internal/registry/regsrc" + "github.com/hashicorp/terraform/internal/registry/response" tfversion "github.com/hashicorp/terraform/version" ) diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index ffca0ff7b..8b05fc186 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -17,10 +17,10 @@ import ( "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs/configload" "github.com/hashicorp/terraform/internal/initwd" + "github.com/hashicorp/terraform/internal/registry" "github.com/hashicorp/terraform/plans" "github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/registry" "github.com/hashicorp/terraform/states" _ "github.com/hashicorp/terraform/internal/logging"