addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost

As the comment notes, this hostname is the default for provide source
addresses. We'll shortly be adding some address types to represent module
source addresses too, and so we'll also have DefaultModuleRegistryHost
for that situation.

(They'll actually both contain the the same hostname, but that's a
coincidence rather than a requirement.)
This commit is contained in:
Martin Atkins 2021-05-27 11:09:28 -07:00
parent 0f015a7ff2
commit e5f52e56f8
15 changed files with 89 additions and 89 deletions

View File

@ -19,9 +19,9 @@ type Provider struct {
Hostname svchost.Hostname
}
// DefaultRegistryHost is the hostname used for provider addresses that do
// DefaultProviderRegistryHost is the hostname used for provider addresses that do
// not have an explicit hostname.
const DefaultRegistryHost = svchost.Hostname("registry.terraform.io")
const DefaultProviderRegistryHost = svchost.Hostname("registry.terraform.io")
// BuiltInProviderHost is the pseudo-hostname used for the "built-in" provider
// namespace. Built-in provider addresses must also have their namespace set
@ -59,7 +59,7 @@ func (pt Provider) ForDisplay() string {
panic("called ForDisplay on zero-value addrs.Provider")
}
if pt.Hostname == DefaultRegistryHost {
if pt.Hostname == DefaultProviderRegistryHost {
return pt.Namespace + "/" + pt.Type
}
return pt.Hostname.ForDisplay() + "/" + pt.Namespace + "/" + pt.Type
@ -121,7 +121,7 @@ func NewDefaultProvider(name string) Provider {
return Provider{
Type: MustParseProviderPart(name),
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
}
}
@ -144,7 +144,7 @@ func NewLegacyProvider(name string) Provider {
// verbatim, even if not compliant with our new naming rules.
Type: name,
Namespace: LegacyProviderNamespace,
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
}
}
@ -204,7 +204,7 @@ func (pt Provider) IsLegacy() bool {
panic("called IsLegacy() on zero-value addrs.Provider")
}
return pt.Hostname == DefaultRegistryHost && pt.Namespace == LegacyProviderNamespace
return pt.Hostname == DefaultProviderRegistryHost && pt.Namespace == LegacyProviderNamespace
}
@ -214,7 +214,7 @@ func (pt Provider) IsDefault() bool {
panic("called IsDefault() on zero-value addrs.Provider")
}
return pt.Hostname == DefaultRegistryHost && pt.Namespace == "hashicorp"
return pt.Hostname == DefaultProviderRegistryHost && pt.Namespace == "hashicorp"
}
// Equals returns true if the receiver and other provider have the same attributes.
@ -269,7 +269,7 @@ func ParseProviderSourceString(str string) (Provider, tfdiags.Diagnostics) {
return ret, diags
}
ret.Type = name
ret.Hostname = DefaultRegistryHost
ret.Hostname = DefaultProviderRegistryHost
if len(parts) == 1 {
return NewDefaultProvider(parts[0]), diags
@ -312,14 +312,14 @@ func ParseProviderSourceString(str string) (Provider, tfdiags.Diagnostics) {
ret.Hostname = hn
}
if ret.Namespace == LegacyProviderNamespace && ret.Hostname != DefaultRegistryHost {
if ret.Namespace == LegacyProviderNamespace && ret.Hostname != DefaultProviderRegistryHost {
// Legacy provider addresses must always be on the default registry
// host, because the default registry host decides what actual FQN
// each one maps to.
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid provider namespace",
Detail: "The legacy provider namespace \"-\" can be used only with hostname " + DefaultRegistryHost.ForDisplay() + ".",
Detail: "The legacy provider namespace \"-\" can be used only with hostname " + DefaultProviderRegistryHost.ForDisplay() + ".",
})
return Provider{}, diags
}

View File

@ -15,7 +15,7 @@ func TestProviderString(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "hashicorp",
},
NewDefaultProvider("test").String(),
@ -23,7 +23,7 @@ func TestProviderString(t *testing.T) {
{
Provider{
Type: "test-beta",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "hashicorp",
},
NewDefaultProvider("test-beta").String(),
@ -39,10 +39,10 @@ func TestProviderString(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "othercorp",
},
DefaultRegistryHost.ForDisplay() + "/othercorp/test",
DefaultProviderRegistryHost.ForDisplay() + "/othercorp/test",
},
}
@ -62,7 +62,7 @@ func TestProviderLegacyString(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: LegacyProviderNamespace,
},
"test",
@ -93,7 +93,7 @@ func TestProviderDisplay(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "hashicorp",
},
"hashicorp/test",
@ -109,7 +109,7 @@ func TestProviderDisplay(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "othercorp",
},
"othercorp/test",
@ -132,7 +132,7 @@ func TestProviderIsDefault(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "hashicorp",
},
true,
@ -148,7 +148,7 @@ func TestProviderIsDefault(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "othercorp",
},
false,
@ -195,7 +195,7 @@ func TestProviderIsBuiltIn(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: BuiltInProviderNamespace,
},
false,
@ -203,7 +203,7 @@ func TestProviderIsBuiltIn(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "hashicorp",
},
false,
@ -219,7 +219,7 @@ func TestProviderIsBuiltIn(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "othercorp",
},
false,
@ -242,7 +242,7 @@ func TestProviderIsLegacy(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: LegacyProviderNamespace,
},
true,
@ -258,7 +258,7 @@ func TestProviderIsLegacy(t *testing.T) {
{
Provider{
Type: "test",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
Namespace: "hashicorp",
},
false,
@ -282,7 +282,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "aws",
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -290,7 +290,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "aws",
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -298,7 +298,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "aws",
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -306,7 +306,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "aws",
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -314,7 +314,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "aws",
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -322,7 +322,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "aws",
Namespace: "hashicorp",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -338,7 +338,7 @@ func TestParseProviderSourceStr(t *testing.T) {
Provider{
Type: "baz-boop",
Namespace: "foo-bar",
Hostname: DefaultRegistryHost,
Hostname: DefaultProviderRegistryHost,
},
false,
},
@ -529,22 +529,22 @@ func TestProviderEquals(t *testing.T) {
Want bool
}{
{
NewProvider(DefaultRegistryHost, "foo", "test"),
NewProvider(DefaultRegistryHost, "foo", "test"),
NewProvider(DefaultProviderRegistryHost, "foo", "test"),
NewProvider(DefaultProviderRegistryHost, "foo", "test"),
true,
},
{
NewProvider(DefaultRegistryHost, "foo", "test"),
NewProvider(DefaultRegistryHost, "bar", "test"),
NewProvider(DefaultProviderRegistryHost, "foo", "test"),
NewProvider(DefaultProviderRegistryHost, "bar", "test"),
false,
},
{
NewProvider(DefaultRegistryHost, "foo", "test"),
NewProvider(DefaultRegistryHost, "foo", "my-test"),
NewProvider(DefaultProviderRegistryHost, "foo", "test"),
NewProvider(DefaultProviderRegistryHost, "foo", "my-test"),
false,
},
{
NewProvider(DefaultRegistryHost, "foo", "test"),
NewProvider(DefaultProviderRegistryHost, "foo", "test"),
NewProvider("example.com", "foo", "test"),
false,
},

View File

@ -55,8 +55,8 @@ func TestConfigProviderTypes_nested(t *testing.T) {
got = cfg.ProviderTypes()
want := []addrs.Provider{
addrs.NewProvider(addrs.DefaultRegistryHost, "bar", "test"),
addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test"),
addrs.NewProvider(addrs.DefaultProviderRegistryHost, "bar", "test"),
addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test"),
addrs.NewDefaultProvider("test"),
}
@ -105,7 +105,7 @@ func TestConfigResolveAbsProviderAddr(t *testing.T) {
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModule)
want := addrs.AbsProviderConfig{
Module: addrs.RootModule,
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test"),
Provider: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test"),
Alias: "boop",
}
if got, want := got.String(), want.String(); got != want {
@ -124,7 +124,7 @@ func TestConfigProviderRequirements(t *testing.T) {
assertDiagnosticSummary(t, diags, "Version constraints inside provider configuration blocks are deprecated")
tlsProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "tls",
)
happycloudProvider := addrs.NewProvider(
@ -167,7 +167,7 @@ func TestConfigProviderRequirementsShallow(t *testing.T) {
assertDiagnosticSummary(t, diags, "Version constraints inside provider configuration blocks are deprecated")
tlsProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "tls",
)
nullProvider := addrs.NewDefaultProvider("null")
@ -203,7 +203,7 @@ func TestConfigProviderRequirementsByModule(t *testing.T) {
assertDiagnosticSummary(t, diags, "Version constraints inside provider configuration blocks are deprecated")
tlsProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "tls",
)
happycloudProvider := addrs.NewProvider(
@ -267,7 +267,7 @@ func TestConfigProviderForConfigAddr(t *testing.T) {
assertNoDiagnostics(t, diags)
got := cfg.ProviderForConfigAddr(addrs.NewDefaultLocalProviderConfig("foo-test"))
want := addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test")
want := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test")
if !got.Equals(want) {
t.Errorf("wrong result\ngot: %s\nwant: %s", got, want)
}

View File

@ -288,7 +288,7 @@ func TestModuleOverrideResourceFQNs(t *testing.T) {
assertNoDiagnostics(t, diags)
got := mod.ManagedResources["test_instance.explicit"]
wantProvider := addrs.NewProvider(addrs.DefaultRegistryHost, "bar", "test")
wantProvider := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "bar", "test")
wantProviderCfg := &ProviderConfigRef{
Name: "bar-test",
NameRange: hcl.Range{

View File

@ -14,7 +14,7 @@ func TestNewModule_provider_local_name(t *testing.T) {
t.Fatal(diags.Error())
}
p := addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test")
p := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test")
if name, exists := mod.ProviderLocalNames[p]; !exists {
t.Fatal("provider FQN foo/test not found")
} else {
@ -38,7 +38,7 @@ func TestNewModule_provider_local_name(t *testing.T) {
// can also look up the "terraform" provider and see that it sources is
// allowed to be overridden, even though there is a builtin provider
// called "terraform".
p = addrs.NewProvider(addrs.DefaultRegistryHost, "not-builtin", "not-terraform")
p = addrs.NewProvider(addrs.DefaultProviderRegistryHost, "not-builtin", "not-terraform")
if name, exists := mod.ProviderLocalNames[p]; !exists {
t.Fatal("provider FQN not-builtin/not-terraform not found")
} else {
@ -59,8 +59,8 @@ func TestNewModule_resource_providers(t *testing.T) {
// the default implied provider and one explicitly using a provider set in
// required_providers
wantImplicit := addrs.NewDefaultProvider("test")
wantFoo := addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test")
wantBar := addrs.NewProvider(addrs.DefaultRegistryHost, "bar", "test")
wantFoo := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test")
wantBar := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "bar", "test")
// root module
if !cfg.Module.ManagedResources["test_instance.explicit"].Provider.Equals(wantFoo) {
@ -107,7 +107,7 @@ func TestProviderForLocalConfig(t *testing.T) {
}
lc := addrs.LocalProviderConfig{LocalName: "foo-test"}
got := mod.ProviderForLocalConfig(lc)
want := addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test")
want := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test")
if !got.Equals(want) {
t.Fatalf("wrong result! got %#v, want %#v\n", got, want)
}
@ -135,7 +135,7 @@ func TestModule_required_providers_after_resource(t *testing.T) {
t.Fatal(diags.Error())
}
want := addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test")
want := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "foo", "test")
req, exists := mod.ProviderRequirements.RequiredProviders["test"]
if !exists {
@ -165,7 +165,7 @@ func TestModule_required_provider_overrides(t *testing.T) {
}
// The foo provider and resource should be unaffected
want := addrs.NewProvider(addrs.DefaultRegistryHost, "acme", "foo")
want := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "acme", "foo")
req, exists := mod.ProviderRequirements.RequiredProviders["foo"]
if !exists {
t.Fatal("no provider requirements found for \"foo\"")
@ -182,7 +182,7 @@ func TestModule_required_provider_overrides(t *testing.T) {
}
// The bar provider and resource should be using the override config
want = addrs.NewProvider(addrs.DefaultRegistryHost, "blorp", "bar")
want = addrs.NewProvider(addrs.DefaultProviderRegistryHost, "blorp", "bar")
req, exists = mod.ProviderRequirements.RequiredProviders["bar"]
if !exists {
t.Fatal("no provider requirements found for \"bar\"")
@ -223,7 +223,7 @@ func TestModule_implied_provider(t *testing.T) {
// The three providers used in the config resources
foo := addrs.NewProvider("registry.acme.corp", "acme", "foo")
whatever := addrs.NewProvider(addrs.DefaultRegistryHost, "acme", "something")
whatever := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "acme", "something")
bar := addrs.NewDefaultProvider("bar")
// Verify that the registry.acme.corp/acme/foo provider is defined in the
@ -289,7 +289,7 @@ func TestImpliedProviderForUnqualifiedType(t *testing.T) {
}
foo := addrs.NewProvider("registry.acme.corp", "acme", "foo")
whatever := addrs.NewProvider(addrs.DefaultRegistryHost, "acme", "something")
whatever := addrs.NewProvider(addrs.DefaultProviderRegistryHost, "acme", "something")
bar := addrs.NewDefaultProvider("bar")
tf := addrs.NewBuiltInProvider("terraform")

View File

@ -94,7 +94,7 @@ func TestDecodeRequiredProvidersBlock(t *testing.T) {
"my-test": {
Name: "my-test",
Source: "mycloud/test",
Type: addrs.NewProvider(addrs.DefaultRegistryHost, "mycloud", "test"),
Type: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "mycloud", "test"),
Requirement: testVC("2.0.0"),
DeclRange: mockRange,
},
@ -133,7 +133,7 @@ func TestDecodeRequiredProvidersBlock(t *testing.T) {
"my-test": {
Name: "my-test",
Source: "mycloud/test",
Type: addrs.NewProvider(addrs.DefaultRegistryHost, "mycloud", "test"),
Type: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "mycloud", "test"),
Requirement: testVC("2.0.0"),
DeclRange: mockRange,
},

View File

@ -18,19 +18,19 @@ func TestConfigProviderRequirements(t *testing.T) {
cfg := testConfig(t, "testdata/provider-reqs")
impliedProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "implied",
)
nullProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "null",
)
randomProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "random",
)
tlsProvider := addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "tls",
)
happycloudProvider := addrs.NewProvider(

View File

@ -105,7 +105,7 @@ func SearchLocalDirectory(baseDir string) (map[addrs.Provider]PackageMetaList, e
}
var providerAddr addrs.Provider
if namespace == addrs.LegacyProviderNamespace {
if hostname != addrs.DefaultRegistryHost {
if hostname != addrs.DefaultProviderRegistryHost {
log.Printf("[WARN] local provider path %q indicates a legacy provider not on the default registry host; ignoring", fullPath)
return nil
}

View File

@ -229,7 +229,7 @@ const Wildcard string = "*"
// We'll read the default registry host from over in the addrs package, to
// avoid duplicating it. A "default" provider uses the default registry host
// by definition.
var defaultRegistryHost = addrs.DefaultRegistryHost
var defaultRegistryHost = addrs.DefaultProviderRegistryHost
func normalizeProviderNameOrWildcard(s string) (string, error) {
if s == Wildcard {

View File

@ -10,7 +10,7 @@ import (
func TestCachedProviderHash(t *testing.T) {
cp := &CachedProvider{
Provider: addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "null",
),
Version: getproviders.MustParseVersion("2.0.0"),
@ -40,7 +40,7 @@ func TestCachedProviderHash(t *testing.T) {
// has a .exe suffix, but the darwin build (hashed above) does not.
cp2 := &CachedProvider{
Provider: addrs.NewProvider(
addrs.DefaultRegistryHost,
addrs.DefaultProviderRegistryHost,
"hashicorp", "null",
),
Version: getproviders.MustParseVersion("2.0.0"),
@ -65,7 +65,7 @@ func TestExecutableFile(t *testing.T) {
}{
"linux": {
cp: &CachedProvider{
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "hashicorp", "null"),
Provider: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "hashicorp", "null"),
Version: getproviders.MustParseVersion("2.0.0"),
PackageDir: "testdata/cachedir/registry.terraform.io/hashicorp/null/2.0.0/linux_amd64",
},
@ -73,7 +73,7 @@ func TestExecutableFile(t *testing.T) {
},
"windows": {
cp: &CachedProvider{
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "hashicorp", "null"),
Provider: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "hashicorp", "null"),
Version: getproviders.MustParseVersion("2.0.0"),
PackageDir: "testdata/cachedir/registry.terraform.io/hashicorp/null/2.0.0/windows_amd64",
},
@ -81,7 +81,7 @@ func TestExecutableFile(t *testing.T) {
},
"missing-executable": {
cp: &CachedProvider{
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "missing", "executable"),
Provider: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "missing", "executable"),
Version: getproviders.MustParseVersion("2.0.0"),
PackageDir: "testdata/cachedir/registry.terraform.io/missing/executable/2.0.0/linux_amd64",
},
@ -89,7 +89,7 @@ func TestExecutableFile(t *testing.T) {
},
"missing-dir": {
cp: &CachedProvider{
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "missing", "packagedir"),
Provider: addrs.NewProvider(addrs.DefaultProviderRegistryHost, "missing", "packagedir"),
Version: getproviders.MustParseVersion("2.0.0"),
PackageDir: "testdata/cachedir/registry.terraform.io/missing/packagedir/2.0.0/linux_amd64",
},

View File

@ -30,7 +30,7 @@ func TestInstallPackage(t *testing.T) {
Arch: "amd64",
}
nullProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "hashicorp", "null",
addrs.DefaultProviderRegistryHost, "hashicorp", "null",
)
tmpDir := NewDirWithPlatform(tmpDirPath, linuxPlatform)
@ -89,7 +89,7 @@ func TestLinkFromOtherCache(t *testing.T) {
Arch: "amd64",
}
nullProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "hashicorp", "null",
addrs.DefaultProviderRegistryHost, "hashicorp", "null",
)
srcDir := NewDirWithPlatform(srcDirPath, windowsPlatform)

View File

@ -25,20 +25,20 @@ func TestDirReading(t *testing.T) {
}
nullProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "hashicorp", "null",
addrs.DefaultProviderRegistryHost, "hashicorp", "null",
)
randomProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "hashicorp", "random",
addrs.DefaultProviderRegistryHost, "hashicorp", "random",
)
randomBetaProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "hashicorp", "random-beta",
addrs.DefaultProviderRegistryHost, "hashicorp", "random-beta",
)
nonExistProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "bloop", "nonexist",
addrs.DefaultProviderRegistryHost, "bloop", "nonexist",
)
legacyProvider := addrs.NewLegacyProvider("legacy")
missingExecutableProvider := addrs.NewProvider(
addrs.DefaultRegistryHost, "missing", "executable",
addrs.DefaultProviderRegistryHost, "missing", "executable",
)
t.Run("ProviderLatestVersion", func(t *testing.T) {

View File

@ -173,7 +173,7 @@ func TestEvaluatorGetResource(t *testing.T) {
"id": cty.StringVal("foo"),
}),
Provider: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "hashicorp",
Type: "test",
},
@ -420,7 +420,7 @@ func TestEvaluatorGetResource_changes(t *testing.T) {
Type: "test_resource",
Name: "foo",
Provider: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "hashicorp",
Type: "test",
},

View File

@ -24,7 +24,7 @@ func TestNodeAbstractResourceInstanceProvider(t *testing.T) {
Name: "baz",
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
Want: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "hashicorp",
Type: "null",
},
@ -53,14 +53,14 @@ func TestNodeAbstractResourceInstanceProvider(t *testing.T) {
// Just enough configs.Resource for the Provider method. Not
// actually valid for general use.
Provider: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},
},
// The config overrides the default behavior.
Want: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},
@ -75,14 +75,14 @@ func TestNodeAbstractResourceInstanceProvider(t *testing.T) {
// Just enough configs.Resource for the Provider method. Not
// actually valid for general use.
Provider: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},
},
// The config overrides the default behavior.
Want: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},

View File

@ -25,7 +25,7 @@ func TestNodeAbstractResourceProvider(t *testing.T) {
Name: "baz",
}.InModule(addrs.RootModule),
Want: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "hashicorp",
Type: "null",
},
@ -54,14 +54,14 @@ func TestNodeAbstractResourceProvider(t *testing.T) {
// Just enough configs.Resource for the Provider method. Not
// actually valid for general use.
Provider: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},
},
// The config overrides the default behavior.
Want: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},
@ -76,14 +76,14 @@ func TestNodeAbstractResourceProvider(t *testing.T) {
// Just enough configs.Resource for the Provider method. Not
// actually valid for general use.
Provider: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},
},
// The config overrides the default behavior.
Want: addrs.Provider{
Hostname: addrs.DefaultRegistryHost,
Hostname: addrs.DefaultProviderRegistryHost,
Namespace: "awesomecorp",
Type: "happycloud",
},