mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com> Signed-off-by: Christian Mesh <christianmesh1@gmail.com> Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
parent
1a7b68aa56
commit
15bef1428a
@ -14,6 +14,10 @@ import (
|
||||
// extended to include additional fields including Namespace and SourceHost
|
||||
type Provider = tfaddr.Provider
|
||||
|
||||
// DefaultProviderNamespace contains the registry namespace OpenTofu looks up providers in
|
||||
// if no namespace has been explicitly specified.
|
||||
const DefaultProviderNamespace = "opentofu"
|
||||
|
||||
// DefaultProviderRegistryHost is the hostname used for provider addresses that do
|
||||
// not have an explicit hostname.
|
||||
const DefaultProviderRegistryHost = tfaddr.DefaultProviderRegistryHost
|
||||
@ -40,7 +44,7 @@ const BuiltInProviderNamespace = tfaddr.BuiltInProviderNamespace
|
||||
const LegacyProviderNamespace = tfaddr.LegacyProviderNamespace
|
||||
|
||||
func IsDefaultProvider(addr Provider) bool {
|
||||
return addr.Hostname == DefaultProviderRegistryHost && addr.Namespace == "hashicorp"
|
||||
return addr.Hostname == DefaultProviderRegistryHost && addr.Namespace == DefaultProviderNamespace
|
||||
}
|
||||
|
||||
// NewProvider constructs a provider address from its parts, and normalizes
|
||||
@ -62,18 +66,18 @@ func NewProvider(hostname svchost.Hostname, namespace, typeName string) Provider
|
||||
// provider FQN a user intended when only a naked type name is available.
|
||||
//
|
||||
// For all except the type name "terraform" this returns a so-called "default"
|
||||
// provider, which is under the registry.terraform.io/hashicorp/ namespace.
|
||||
// provider, which is under the registry.opentofu.org/opentofu/ namespace.
|
||||
//
|
||||
// As a special case, the string "terraform" maps to
|
||||
// "terraform.io/builtin/terraform" because that is the more likely user
|
||||
// intent than the now-unmaintained "registry.terraform.io/hashicorp/terraform"
|
||||
// which remains only for compatibility with older OpenTofu versions.
|
||||
// which remains only for compatibility with older Terraform versions.
|
||||
func ImpliedProviderForUnqualifiedType(typeName string) Provider {
|
||||
switch typeName {
|
||||
case "terraform":
|
||||
// Note for future maintainers: any additional strings we add here
|
||||
// as implied to be builtin must never also be use as provider names
|
||||
// in the registry.terraform.io/hashicorp/... namespace, because
|
||||
// in the registry.opentofu.org/opentofu/... namespace, because
|
||||
// otherwise older versions of OpenTofu could implicitly select
|
||||
// the registry name instead of the internal one.
|
||||
return NewBuiltInProvider(typeName)
|
||||
@ -87,7 +91,7 @@ func ImpliedProviderForUnqualifiedType(typeName string) Provider {
|
||||
func NewDefaultProvider(name string) Provider {
|
||||
return tfaddr.Provider{
|
||||
Type: MustParseProviderPart(name),
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
}
|
||||
}
|
||||
@ -139,7 +143,7 @@ func ParseProviderSourceString(str string) (tfaddr.Provider, tfdiags.Diagnostics
|
||||
}
|
||||
|
||||
if !ret.HasKnownNamespace() {
|
||||
ret.Namespace = "hashicorp"
|
||||
ret.Namespace = DefaultProviderNamespace
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
|
@ -101,10 +101,10 @@ var _ ProviderConfig = AbsProviderConfig{}
|
||||
// configuration address. The following are examples of traversals that can be
|
||||
// successfully parsed as absolute provider configuration addresses:
|
||||
//
|
||||
// - provider["registry.opentofu.org/hashicorp/aws"]
|
||||
// - provider["registry.opentofu.org/hashicorp/aws"].foo
|
||||
// - module.bar.provider["registry.opentofu.org/hashicorp/aws"]
|
||||
// - module.bar.module.baz.provider["registry.opentofu.org/hashicorp/aws"].foo
|
||||
// - provider["registry.opentofu.org/opentofu/aws"]
|
||||
// - provider["registry.opentofu.org/opentofu/aws"].foo
|
||||
// - module.bar.provider["registry.opentofu.org/opentofu/aws"]
|
||||
// - module.bar.module.baz.provider["registry.opentofu.org/opentofu/aws"].foo
|
||||
//
|
||||
// This type of address is used, for example, to record the relationships
|
||||
// between resources and provider configurations in the state structure.
|
||||
|
@ -20,24 +20,24 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||
WantDiag string
|
||||
}{
|
||||
{
|
||||
`provider["registry.opentofu.org/hashicorp/aws"]`,
|
||||
`provider["registry.opentofu.org/opentofu/aws"]`,
|
||||
AbsProviderConfig{
|
||||
Module: RootModule,
|
||||
Provider: Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: "opentofu",
|
||||
Hostname: "registry.opentofu.org",
|
||||
},
|
||||
},
|
||||
``,
|
||||
},
|
||||
{
|
||||
`provider["registry.opentofu.org/hashicorp/aws"].foo`,
|
||||
`provider["registry.opentofu.org/opentofu/aws"].foo`,
|
||||
AbsProviderConfig{
|
||||
Module: RootModule,
|
||||
Provider: Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: "opentofu",
|
||||
Hostname: "registry.opentofu.org",
|
||||
},
|
||||
Alias: "foo",
|
||||
@ -45,24 +45,24 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||
``,
|
||||
},
|
||||
{
|
||||
`module.baz.provider["registry.opentofu.org/hashicorp/aws"]`,
|
||||
`module.baz.provider["registry.opentofu.org/opentofu/aws"]`,
|
||||
AbsProviderConfig{
|
||||
Module: Module{"baz"},
|
||||
Provider: Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: "opentofu",
|
||||
Hostname: "registry.opentofu.org",
|
||||
},
|
||||
},
|
||||
``,
|
||||
},
|
||||
{
|
||||
`module.baz.provider["registry.opentofu.org/hashicorp/aws"].foo`,
|
||||
`module.baz.provider["registry.opentofu.org/opentofu/aws"].foo`,
|
||||
AbsProviderConfig{
|
||||
Module: Module{"baz"},
|
||||
Provider: Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: "opentofu",
|
||||
Hostname: "registry.opentofu.org",
|
||||
},
|
||||
Alias: "foo",
|
||||
@ -70,17 +70,17 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||
``,
|
||||
},
|
||||
{
|
||||
`module.baz["foo"].provider["registry.opentofu.org/hashicorp/aws"]`,
|
||||
`module.baz["foo"].provider["registry.opentofu.org/opentofu/aws"]`,
|
||||
AbsProviderConfig{},
|
||||
`Provider address cannot contain module indexes`,
|
||||
},
|
||||
{
|
||||
`module.baz[1].provider["registry.opentofu.org/hashicorp/aws"]`,
|
||||
`module.baz[1].provider["registry.opentofu.org/opentofu/aws"]`,
|
||||
AbsProviderConfig{},
|
||||
`Provider address cannot contain module indexes`,
|
||||
},
|
||||
{
|
||||
`module.baz[1].module.bar.provider["registry.opentofu.org/hashicorp/aws"]`,
|
||||
`module.baz[1].module.bar.provider["registry.opentofu.org/opentofu/aws"]`,
|
||||
AbsProviderConfig{},
|
||||
`Provider address cannot contain module indexes`,
|
||||
},
|
||||
@ -173,7 +173,7 @@ func TestAbsProviderConfigString(t *testing.T) {
|
||||
Module: RootModule.Child("child_module"),
|
||||
Provider: NewDefaultProvider("foo"),
|
||||
},
|
||||
`module.child_module.provider["registry.opentofu.org/hashicorp/foo"]`,
|
||||
`module.child_module.provider["registry.opentofu.org/opentofu/foo"]`,
|
||||
},
|
||||
{
|
||||
AbsProviderConfig{
|
||||
@ -181,7 +181,7 @@ func TestAbsProviderConfigString(t *testing.T) {
|
||||
Alias: "bar",
|
||||
Provider: NewDefaultProvider("foo"),
|
||||
},
|
||||
`provider["registry.opentofu.org/hashicorp/foo"].bar`,
|
||||
`provider["registry.opentofu.org/opentofu/foo"].bar`,
|
||||
},
|
||||
{
|
||||
AbsProviderConfig{
|
||||
@ -189,7 +189,7 @@ func TestAbsProviderConfigString(t *testing.T) {
|
||||
Alias: "bar",
|
||||
Provider: NewDefaultProvider("foo"),
|
||||
},
|
||||
`module.child_module.provider["registry.opentofu.org/hashicorp/foo"].bar`,
|
||||
`module.child_module.provider["registry.opentofu.org/opentofu/foo"].bar`,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ func TestProviderString(t *testing.T) {
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
NewDefaultProvider("test").String(),
|
||||
},
|
||||
@ -27,17 +27,17 @@ func TestProviderString(t *testing.T) {
|
||||
Provider{
|
||||
Type: "test-beta",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
NewDefaultProvider("test-beta").String(),
|
||||
},
|
||||
{
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: "registry.terraform.com",
|
||||
Namespace: "hashicorp",
|
||||
Hostname: "registry.example.com",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
"registry.terraform.com/hashicorp/test",
|
||||
"registry.example.com/" + DefaultProviderNamespace + "/test",
|
||||
},
|
||||
{
|
||||
Provider{
|
||||
@ -97,17 +97,17 @@ func TestProviderDisplay(t *testing.T) {
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
"hashicorp/test",
|
||||
DefaultProviderNamespace + "/test",
|
||||
},
|
||||
{
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: "registry.terraform.com",
|
||||
Namespace: "hashicorp",
|
||||
Hostname: "registry.example.com",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
"registry.terraform.com/hashicorp/test",
|
||||
"registry.example.com/" + DefaultProviderNamespace + "/test",
|
||||
},
|
||||
{
|
||||
Provider{
|
||||
@ -136,15 +136,15 @@ func TestProviderIsDefaultProvider(t *testing.T) {
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: "registry.terraform.com",
|
||||
Namespace: "hashicorp",
|
||||
Hostname: "registry.example.com",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@ -207,15 +207,15 @@ func TestProviderIsBuiltIn(t *testing.T) {
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: "registry.terraform.com",
|
||||
Namespace: "hashicorp",
|
||||
Hostname: "registry.example.com",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@ -253,7 +253,7 @@ func TestProviderIsLegacy(t *testing.T) {
|
||||
{
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: "registry.terraform.com",
|
||||
Hostname: "registry.example.com",
|
||||
Namespace: LegacyProviderNamespace,
|
||||
},
|
||||
false,
|
||||
@ -262,7 +262,7 @@ func TestProviderIsLegacy(t *testing.T) {
|
||||
Provider{
|
||||
Type: "test",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
},
|
||||
false,
|
||||
},
|
||||
@ -281,34 +281,36 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
Want Provider
|
||||
Err bool
|
||||
}{
|
||||
"registry.opentofu.org/hashicorp/aws": {
|
||||
string(DefaultProviderRegistryHost) + "/" + DefaultProviderNamespace + "/aws": {
|
||||
Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
},
|
||||
false,
|
||||
},
|
||||
"registry.opentofu.org/HashiCorp/AWS": {
|
||||
// Note: this is a capitalization test and intentionally spells out the namespace intentionally.
|
||||
string(DefaultProviderRegistryHost) + "/OpenTofu/AWS": {
|
||||
Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: "opentofu",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
},
|
||||
false,
|
||||
},
|
||||
"hashicorp/aws": {
|
||||
DefaultProviderNamespace + "/aws": {
|
||||
Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
},
|
||||
false,
|
||||
},
|
||||
"HashiCorp/AWS": {
|
||||
// Note: this is a capitalization test and intentionally spells out the namespace intentionally.
|
||||
"OpenTofu/AWS": {
|
||||
Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: "opentofu",
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
},
|
||||
false,
|
||||
@ -316,7 +318,7 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
"aws": {
|
||||
Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
},
|
||||
false,
|
||||
@ -324,7 +326,7 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
"AWS": {
|
||||
Provider{
|
||||
Type: "aws",
|
||||
Namespace: "hashicorp",
|
||||
Namespace: DefaultProviderNamespace,
|
||||
Hostname: DefaultProviderRegistryHost,
|
||||
},
|
||||
false,
|
||||
@ -369,7 +371,7 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"badhost!/hashicorp/aws": {
|
||||
"badhost!/opentofu/aws": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
@ -393,23 +395,23 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/badtype!": {
|
||||
"example.com/opentofu/badtype!": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/bad--type": {
|
||||
"example.com/opentofu/bad--type": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/-badtype": {
|
||||
"example.com/opentofu/-badtype": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/badtype-": {
|
||||
"example.com/opentofu/badtype-": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/bad.type": {
|
||||
"example.com/opentofu/bad.type": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
@ -419,11 +421,11 @@ func TestParseProviderSourceStr(t *testing.T) {
|
||||
// the longer prefix terraform-provider- to hint for users who might be
|
||||
// accidentally using the git repository name or executable file name
|
||||
// instead of the provider type.
|
||||
"example.com/hashicorp/terraform-provider-bad": {
|
||||
"example.com/opentofu/terraform-provider-bad": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
"example.com/hashicorp/terraform-bad": {
|
||||
"example.com/opentofu/terraform-bad": {
|
||||
Provider{},
|
||||
true,
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ func TestLocal_applyBasic(t *testing.T) {
|
||||
checkState(t, b.StateOutPath, `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
ami = bar
|
||||
`)
|
||||
|
||||
@ -241,7 +241,7 @@ func TestLocal_applyError(t *testing.T) {
|
||||
checkState(t, b.StateOutPath, `
|
||||
test_instance.foo:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
ami = bar
|
||||
`)
|
||||
|
||||
@ -308,7 +308,7 @@ func TestLocal_applyBackendFail(t *testing.T) {
|
||||
checkState(t, "errored.tfstate", `
|
||||
test_instance.foo: (tainted)
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
ami = bar
|
||||
`)
|
||||
|
||||
@ -372,7 +372,7 @@ func testOperationApply(t *testing.T, configDir string) (*backend.Operation, fun
|
||||
// Many of our tests use an overridden "test" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/test"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/test"))
|
||||
|
||||
return &backend.Operation{
|
||||
Type: backend.OperationTypeApply,
|
||||
|
@ -725,7 +725,7 @@ func testOperationPlan(t *testing.T, configDir string) (*backend.Operation, func
|
||||
// Many of our tests use an overridden "test" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/test"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/test"))
|
||||
|
||||
return &backend.Operation{
|
||||
Type: backend.OperationTypePlan,
|
||||
|
@ -53,7 +53,7 @@ func TestLocal_refresh(t *testing.T) {
|
||||
checkState(t, b.StateOutPath, `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`)
|
||||
|
||||
// the backend should be unlocked after a run
|
||||
@ -122,7 +122,7 @@ func TestLocal_refreshInput(t *testing.T) {
|
||||
checkState(t, b.StateOutPath, `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`)
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ func TestLocal_refreshValidate(t *testing.T) {
|
||||
checkState(t, b.StateOutPath, `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`)
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ func TestLocal_refreshValidateProviderConfigured(t *testing.T) {
|
||||
checkState(t, b.StateOutPath, `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`)
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ func testOperationRefresh(t *testing.T, configDir string) (*backend.Operation, f
|
||||
// Many of our tests use an overridden "test" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/test"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/test"))
|
||||
|
||||
return &backend.Operation{
|
||||
Type: backend.OperationTypeRefresh,
|
||||
@ -297,7 +297,7 @@ func testRefreshState() *states.State {
|
||||
Status: states.ObjectReady,
|
||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||
},
|
||||
mustProviderConfig(`provider["registry.opentofu.org/hashicorp/test"]`),
|
||||
mustProviderConfig(`provider["registry.opentofu.org/opentofu/test"]`),
|
||||
)
|
||||
return state
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func buildArmClient(ctx context.Context, config BackendConfig) (*ArmClient, erro
|
||||
CustomResourceManagerEndpoint: config.CustomResourceManagerEndpoint,
|
||||
MetadataHost: config.MetadataHost,
|
||||
Environment: config.Environment,
|
||||
ClientSecretDocsLink: "https://registry.opentofu.org/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret",
|
||||
ClientSecretDocsLink: "https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret",
|
||||
|
||||
// Service Principal (Client Certificate)
|
||||
ClientCertPassword: config.ClientCertificatePassword,
|
||||
|
@ -330,6 +330,9 @@ func (b *Remote) Configure(obj cty.Value) tfdiags.Diagnostics {
|
||||
Token: token,
|
||||
Headers: make(http.Header),
|
||||
RetryLogHook: b.retryLogHook,
|
||||
// services.Transport defaults to the same cleanhttp pooled transport as tfe.DefaultClient
|
||||
// We need to pass in this transport for ssl overrides during testing
|
||||
HTTPClient: &http.Client{Transport: b.services.Transport},
|
||||
}
|
||||
|
||||
// Set the version header to the current version.
|
||||
|
@ -52,7 +52,7 @@ func testOperationApplyWithTimeout(t *testing.T, configDir string, timeout time.
|
||||
// Many of our tests use an overridden "null" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/null"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/null"))
|
||||
|
||||
return &backend.Operation{
|
||||
ConfigDir: configDir,
|
||||
|
@ -50,7 +50,7 @@ func testOperationPlanWithTimeout(t *testing.T, configDir string, timeout time.D
|
||||
// Many of our tests use an overridden "null" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/null"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/null"))
|
||||
|
||||
return &backend.Operation{
|
||||
ConfigDir: configDir,
|
||||
|
@ -50,7 +50,7 @@ func TestRemote_config(t *testing.T) {
|
||||
}{
|
||||
"with_a_nonexisting_organization": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"hostname": cty.StringVal("app.example.com"),
|
||||
"organization": cty.StringVal("nonexisting"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
@ -58,7 +58,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"prefix": cty.NullVal(cty.String),
|
||||
}),
|
||||
}),
|
||||
confErr: "organization \"nonexisting\" at host app.terraform.io not found",
|
||||
confErr: "organization \"nonexisting\" at host app.example.com not found",
|
||||
},
|
||||
"with_a_missing_hostname": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
@ -75,7 +75,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"with_an_unknown_host": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("nonexisting.local"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -88,7 +88,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"without_a_token": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("localhost"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -100,7 +100,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"with_a_name": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -111,7 +111,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"with_a_prefix": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -122,7 +122,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"without_either_a_name_and_a_prefix": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -134,7 +134,7 @@ func TestRemote_config(t *testing.T) {
|
||||
"with_both_a_name_and_a_prefix": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -149,7 +149,7 @@ func TestRemote_config(t *testing.T) {
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
s := testServer(t)
|
||||
s := testServerTLS(t)
|
||||
b := New(testDisco(s))
|
||||
|
||||
// Validate
|
||||
@ -177,8 +177,8 @@ func TestRemote_versionConstraints(t *testing.T) {
|
||||
}{
|
||||
"compatible version": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"hostname": cty.StringVal("localhost"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -189,8 +189,8 @@ func TestRemote_versionConstraints(t *testing.T) {
|
||||
},
|
||||
"version too old": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"hostname": cty.StringVal("localhost"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -202,8 +202,8 @@ func TestRemote_versionConstraints(t *testing.T) {
|
||||
},
|
||||
"version too new": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"hostname": cty.StringVal("localhost"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -224,25 +224,27 @@ func TestRemote_versionConstraints(t *testing.T) {
|
||||
}()
|
||||
|
||||
for name, tc := range cases {
|
||||
s := testServer(t)
|
||||
b := New(testDisco(s))
|
||||
t.Run(name, func(t *testing.T) {
|
||||
s := testServer(t)
|
||||
b := New(testDisco(s))
|
||||
|
||||
// Set the version for this test.
|
||||
tfversion.Prerelease = tc.prerelease
|
||||
tfversion.Version = tc.version
|
||||
// Set the version for this test.
|
||||
tfversion.Prerelease = tc.prerelease
|
||||
tfversion.Version = tc.version
|
||||
|
||||
// Validate
|
||||
_, valDiags := b.PrepareConfig(tc.config)
|
||||
if valDiags.HasErrors() {
|
||||
t.Fatalf("%s: unexpected validation result: %v", name, valDiags.Err())
|
||||
}
|
||||
// Validate
|
||||
_, valDiags := b.PrepareConfig(tc.config)
|
||||
if valDiags.HasErrors() {
|
||||
t.Fatalf("%s: unexpected validation result: %v", name, valDiags.Err())
|
||||
}
|
||||
|
||||
// Configure
|
||||
confDiags := b.Configure(tc.config)
|
||||
if (confDiags.Err() != nil || tc.result != "") &&
|
||||
(confDiags.Err() == nil || !strings.Contains(confDiags.Err().Error(), tc.result)) {
|
||||
t.Fatalf("%s: unexpected configure result: %v", name, confDiags.Err())
|
||||
}
|
||||
// Configure
|
||||
confDiags := b.Configure(tc.config)
|
||||
if (confDiags.Err() != nil || tc.result != "") &&
|
||||
(confDiags.Err() == nil || !strings.Contains(confDiags.Err().Error(), tc.result)) {
|
||||
t.Fatalf("%s: unexpected configure result: %v", name, confDiags.Err())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -732,19 +734,19 @@ func TestRemote_VerifyWorkspaceTerraformVersion_ignoreFlagSet(t *testing.T) {
|
||||
if got, want := diags[0].Description().Summary, "OpenTofu version mismatch"; got != want {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, want)
|
||||
}
|
||||
wantDetail := "The local OpenTofu version (0.14.0) does not match the configured version for remote workspace hashicorp/prod (0.13.5)."
|
||||
wantDetail := "The local OpenTofu version (0.14.0) does not match the configured version for remote workspace opentofu/prod (0.13.5)."
|
||||
if got := diags[0].Description().Detail; got != wantDetail {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, wantDetail)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemote_ServiceDiscoveryAliases(t *testing.T) {
|
||||
s := testServer(t)
|
||||
s := testServerTLS(t)
|
||||
b := New(testDisco(s))
|
||||
|
||||
diag := b.Configure(cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"hostname": cty.StringVal("app.example.com"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
|
@ -5,6 +5,7 @@ package remote
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -38,7 +39,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
tfeHost = svchost.Hostname("app.terraform.io")
|
||||
tfeHost = svchost.Hostname("app.example.com")
|
||||
credsSrc = auth.StaticCredentialsSource(map[svchost.Hostname]map[string]interface{}{
|
||||
tfeHost: {"token": testCred},
|
||||
})
|
||||
@ -70,8 +71,8 @@ func testInput(t *testing.T, answers map[string]string) *mockInput {
|
||||
|
||||
func testBackendDefault(t *testing.T) (*Remote, func()) {
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"hostname": cty.StringVal("app.example.com"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -83,8 +84,8 @@ func testBackendDefault(t *testing.T) (*Remote, func()) {
|
||||
|
||||
func testBackendNoDefault(t *testing.T) (*Remote, func()) {
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"hostname": cty.StringVal("app.example.com"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -96,7 +97,7 @@ func testBackendNoDefault(t *testing.T) (*Remote, func()) {
|
||||
|
||||
func testBackendNoOperations(t *testing.T) (*Remote, func()) {
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"hostname": cty.StringVal("app.example.com"),
|
||||
"organization": cty.StringVal("no-operations"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
@ -200,12 +201,11 @@ func testLocalBackend(t *testing.T, remote *Remote) backend.Enhanced {
|
||||
return b
|
||||
}
|
||||
|
||||
// testServer returns a *httptest.Server used for local testing.
|
||||
func testServer(t *testing.T) *httptest.Server {
|
||||
func getTestServerMux(t *testing.T) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
// Respond to service discovery calls.
|
||||
mux.HandleFunc("/well-known/terraform.json", func(w http.ResponseWriter, r *http.Request) {
|
||||
mux.HandleFunc("/.well-known/terraform.json", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
io.WriteString(w, `{
|
||||
"state.v2": "/api/v2/",
|
||||
@ -231,8 +231,8 @@ func testServer(t *testing.T) *httptest.Server {
|
||||
w.Header().Set("TFP-API-Version", "2.4")
|
||||
})
|
||||
|
||||
// Respond to the initial query to read the hashicorp org entitlements.
|
||||
mux.HandleFunc("/api/v2/organizations/hashicorp/entitlement-set", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Respond to the initial query to read the opentofu org entitlements.
|
||||
mux.HandleFunc("/api/v2/organizations/opentofu/entitlement-set", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
io.WriteString(w, `{
|
||||
"data": {
|
||||
@ -269,7 +269,7 @@ func testServer(t *testing.T) *httptest.Server {
|
||||
}`)
|
||||
})
|
||||
|
||||
// All tests that are assumed to pass will use the hashicorp organization,
|
||||
// All tests that are assumed to pass will use the opentofu organization,
|
||||
// so for all other organization requests we will return a 404.
|
||||
mux.HandleFunc("/api/v2/organizations/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(404)
|
||||
@ -282,11 +282,22 @@ func testServer(t *testing.T) *httptest.Server {
|
||||
]
|
||||
}`)
|
||||
})
|
||||
|
||||
return httptest.NewServer(mux)
|
||||
return mux
|
||||
}
|
||||
|
||||
// testDisco returns a *disco.Disco mapping app.terraform.io and
|
||||
// testServer returns a *httptest.Server used for local testing.
|
||||
func testServer(t *testing.T) *httptest.Server {
|
||||
return httptest.NewServer(getTestServerMux(t))
|
||||
}
|
||||
|
||||
// testServerTLS returns a *httptest.Server used for local testing with TLS enabled.
|
||||
func testServerTLS(t *testing.T) *httptest.Server {
|
||||
ts := httptest.NewUnstartedServer(getTestServerMux(t))
|
||||
ts.StartTLS()
|
||||
return ts
|
||||
}
|
||||
|
||||
// testDisco returns a *disco.Disco mapping app.example.com and
|
||||
// localhost to a local test server.
|
||||
func testDisco(s *httptest.Server) *disco.Disco {
|
||||
services := map[string]interface{}{
|
||||
@ -296,9 +307,14 @@ func testDisco(s *httptest.Server) *disco.Disco {
|
||||
}
|
||||
d := disco.NewWithCredentialsSource(credsSrc)
|
||||
d.SetUserAgent(httpclient.OpenTofuUserAgent(version.String()))
|
||||
if s.TLS != nil {
|
||||
certPool := x509.NewCertPool()
|
||||
certPool.AddCert(s.Certificate())
|
||||
d.Transport = httpclient.NewTransportWithCustomTrustedCertificates(certPool)
|
||||
}
|
||||
|
||||
d.ForceHostServices(svchost.Hostname("app.terraform.io"), services)
|
||||
d.ForceHostServices(svchost.Hostname("localhost"), services)
|
||||
d.ForceHostServices("app.example.com", services)
|
||||
d.ForceHostServices("localhost", services)
|
||||
return d
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
"type": "test_resource",
|
||||
"name": "main",
|
||||
"each": "list",
|
||||
"provider": "provider[\"registry.opentofu.org/hashicorp/test\"]",
|
||||
"provider": "provider[\"registry.opentofu.org/opentofu/test\"]",
|
||||
"instances": [
|
||||
{
|
||||
"index_key": 0,
|
||||
|
@ -322,6 +322,9 @@ func (b *Cloud) Configure(obj cty.Value) tfdiags.Diagnostics {
|
||||
Token: token,
|
||||
Headers: make(http.Header),
|
||||
RetryLogHook: b.retryLogHook,
|
||||
// services.Transport defaults to the same cleanhttp pooled transport as tfe.DefaultClient
|
||||
// We need to pass in this transport for ssl overrides during testing
|
||||
HTTPClient: &http.Client{Transport: b.services.Transport},
|
||||
}
|
||||
|
||||
// Set the version header to the current version.
|
||||
|
@ -56,7 +56,7 @@ func testOperationApplyWithTimeout(t *testing.T, configDir string, timeout time.
|
||||
// Many of our tests use an overridden "null" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/null"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/null"))
|
||||
|
||||
return &backend.Operation{
|
||||
ConfigDir: configDir,
|
||||
|
@ -53,7 +53,7 @@ func testOperationPlanWithTimeout(t *testing.T, configDir string, timeout time.D
|
||||
// Many of our tests use an overridden "null" provider that's just in-memory
|
||||
// inside the test process, not a separate plugin on disk.
|
||||
depLocks := depsfile.NewLocks()
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/hashicorp/null"))
|
||||
depLocks.SetProviderOverridden(addrs.MustParseProviderSourceString("registry.opentofu.org/opentofu/null"))
|
||||
|
||||
return &backend.Operation{
|
||||
ConfigDir: configDir,
|
||||
|
@ -58,7 +58,7 @@ func TestCloud_backendWithoutHost(t *testing.T) {
|
||||
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal(testBackendSingleWorkspaceName),
|
||||
@ -221,7 +221,7 @@ func TestCloud_PrepareConfigWithEnvVars(t *testing.T) {
|
||||
},
|
||||
"null workspace": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"workspaces": cty.NullVal(cty.String),
|
||||
}),
|
||||
vars: map[string]string{
|
||||
@ -234,7 +234,7 @@ func TestCloud_PrepareConfigWithEnvVars(t *testing.T) {
|
||||
"workspaces": cty.NullVal(cty.String),
|
||||
}),
|
||||
vars: map[string]string{
|
||||
"TF_CLOUD_ORGANIZATION": "hashicorp",
|
||||
"TF_CLOUD_ORGANIZATION": "opentofu",
|
||||
"TF_WORKSPACE": "my-workspace",
|
||||
"TF_CLOUD_PROJECT": "example-project",
|
||||
},
|
||||
@ -358,7 +358,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"with_a_non_tfe_host": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("nontfe.local"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -372,7 +372,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"without_a_token": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("localhost"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -385,7 +385,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"with_tags": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -401,7 +401,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"with_a_name": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -413,7 +413,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"without_a_name_tags": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -426,7 +426,7 @@ func TestCloud_config(t *testing.T) {
|
||||
"with_both_a_name_and_tags": {
|
||||
config: cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.NullVal(cty.String),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
@ -468,9 +468,11 @@ func TestCloud_config(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCloud_configVerifyMinimumTFEVersion(t *testing.T) {
|
||||
skipIfTFENotEnabled(t)
|
||||
|
||||
config := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -505,9 +507,11 @@ func TestCloud_configVerifyMinimumTFEVersion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCloud_configVerifyMinimumTFEVersionInAutomation(t *testing.T) {
|
||||
skipIfTFENotEnabled(t)
|
||||
|
||||
config := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -551,7 +555,7 @@ func TestCloud_setUnavailableTerraformVersion(t *testing.T) {
|
||||
|
||||
config := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -1206,7 +1210,7 @@ func TestCloud_VerifyWorkspaceTerraformVersion_ignoreFlagSet(t *testing.T) {
|
||||
if got, want := diags[0].Description().Summary, "Incompatible TF version"; got != want {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, want)
|
||||
}
|
||||
wantDetail := "The local OpenTofu version (0.14.0) does not meet the version requirements for remote workspace hashicorp/app-prod (0.13.5)."
|
||||
wantDetail := "The local OpenTofu version (0.14.0) does not meet the version requirements for remote workspace opentofu/app-prod (0.13.5)."
|
||||
if got := diags[0].Description().Detail; got != wantDetail {
|
||||
t.Errorf("wrong summary: got %s, want %s", got, wantDetail)
|
||||
}
|
||||
@ -1294,7 +1298,7 @@ func TestCloud_ServiceDiscoveryAliases(t *testing.T) {
|
||||
|
||||
diag := b.Configure(cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal("prod"),
|
||||
|
@ -9,7 +9,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider": "provider[\"registry.opentofu.org/hashicorp/null\"]",
|
||||
"provider": "provider[\"registry.opentofu.org/opentofu/null\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
|
@ -1 +1 @@
|
||||
{"plan_format_version":"1.1","resource_drift":[],"resource_changes":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/hashicorp/null","change":{"actions":["create"],"before":null,"after":{"triggers":null},"after_unknown":{"id":true},"before_sensitive":false,"after_sensitive":{}}}],"relevant_attributes":[],"output_changes":{"complex":{"actions":["create"],"before":null,"after":{"keyA":{"someList":[1,2,3]},"keyB":{"someBool":true,"someStr":"hello"}},"after_unknown":false,"before_sensitive":false,"after_sensitive":false},"secret":{"actions":["create"],"before":null,"after":"8517896e47af3c9ca19a694ea0d6cc30b0dccf08598f33d93e583721fd5f3032","after_unknown":false,"before_sensitive":true,"after_sensitive":true},"simple":{"actions":["create"],"before":null,"after":["some","list"],"after_unknown":false,"before_sensitive":false,"after_sensitive":false}},"provider_schemas":{"registry.opentofu.org/hashicorp/null":{"provider":{"version":0,"block":{"description_kind":"plain"}},"resource_schemas":{"null_resource":{"version":0,"block":{"attributes":{"id":{"type":"string","description":"This is set to a random value at create time.","description_kind":"plain","computed":true},"triggers":{"type":["map","string"],"description":"A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.","description_kind":"plain","optional":true}},"description":"The `null_resource` resource implements the standard resource lifecycle but takes no further action.\n\nThe `triggers` argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.","description_kind":"plain"}}},"data_source_schemas":{"null_data_source":{"version":0,"block":{"attributes":{"has_computed_default":{"type":"string","description":"If set, its literal value will be stored and returned. If not, its value defaults to `\"default\"`. This argument exists primarily for testing and has little practical use.","description_kind":"plain","optional":true,"computed":true},"id":{"type":"string","description":"This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.","description_kind":"plain","deprecated":true,"computed":true},"inputs":{"type":["map","string"],"description":"A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.","description_kind":"plain","optional":true},"outputs":{"type":["map","string"],"description":"After the data source is \"read\", a copy of the `inputs` map.","description_kind":"plain","computed":true},"random":{"type":"string","description":"A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.opentofu.org/providers/hashicorp/random) for more practical random number use-cases.","description_kind":"plain","computed":true}},"description":"The `null_data_source` data source implements the standard data source lifecycle but does not\ninteract with any external APIs.\n\nHistorically, the `null_data_source` was typically used to construct intermediate values to re-use elsewhere in configuration. The\nsame can now be achieved using [locals](https://www.terraform.io/docs/language/values/locals.html).\n","description_kind":"plain","deprecated":true}}}}},"provider_format_version":"1.0"}
|
||||
{"plan_format_version":"1.1","resource_drift":[],"resource_changes":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/opentofu/null","change":{"actions":["create"],"before":null,"after":{"triggers":null},"after_unknown":{"id":true},"before_sensitive":false,"after_sensitive":{}}}],"relevant_attributes":[],"output_changes":{"complex":{"actions":["create"],"before":null,"after":{"keyA":{"someList":[1,2,3]},"keyB":{"someBool":true,"someStr":"hello"}},"after_unknown":false,"before_sensitive":false,"after_sensitive":false},"secret":{"actions":["create"],"before":null,"after":"8517896e47af3c9ca19a694ea0d6cc30b0dccf08598f33d93e583721fd5f3032","after_unknown":false,"before_sensitive":true,"after_sensitive":true},"simple":{"actions":["create"],"before":null,"after":["some","list"],"after_unknown":false,"before_sensitive":false,"after_sensitive":false}},"provider_schemas":{"registry.opentofu.org/opentofu/null":{"provider":{"version":0,"block":{"description_kind":"plain"}},"resource_schemas":{"null_resource":{"version":0,"block":{"attributes":{"id":{"type":"string","description":"This is set to a random value at create time.","description_kind":"plain","computed":true},"triggers":{"type":["map","string"],"description":"A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.","description_kind":"plain","optional":true}},"description":"The `null_resource` resource implements the standard resource lifecycle but takes no further action.\n\nThe `triggers` argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.","description_kind":"plain"}}},"data_source_schemas":{"null_data_source":{"version":0,"block":{"attributes":{"has_computed_default":{"type":"string","description":"If set, its literal value will be stored and returned. If not, its value defaults to `\"default\"`. This argument exists primarily for testing and has little practical use.","description_kind":"plain","optional":true,"computed":true},"id":{"type":"string","description":"This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.","description_kind":"plain","deprecated":true,"computed":true},"inputs":{"type":["map","string"],"description":"A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.","description_kind":"plain","optional":true},"outputs":{"type":["map","string"],"description":"After the data source is \"read\", a copy of the `inputs` map.","description_kind":"plain","computed":true},"random":{"type":"string","description":"A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.opentofu.org/providers/hashicorp/random) for more practical random number use-cases.","description_kind":"plain","computed":true}},"description":"The `null_data_source` data source implements the standard data source lifecycle but does not\ninteract with any external APIs.\n\nHistorically, the `null_data_source` was typically used to construct intermediate values to re-use elsewhere in configuration. The\nsame can now be achieved using [locals](https://www.terraform.io/docs/language/values/locals.html).\n","description_kind":"plain","deprecated":true}}}}},"provider_format_version":"1.0"}
|
@ -7,7 +7,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/null",
|
||||
"provider_name": "registry.opentofu.org/opentofu/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
@ -27,7 +27,7 @@
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/null": {
|
||||
"registry.opentofu.org/opentofu/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -7,7 +7,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/null",
|
||||
"provider_name": "registry.opentofu.org/opentofu/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
@ -27,7 +27,7 @@
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/null": {
|
||||
"registry.opentofu.org/opentofu/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -7,7 +7,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/null",
|
||||
"provider_name": "registry.opentofu.org/opentofu/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
@ -27,7 +27,7 @@
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/null": {
|
||||
"registry.opentofu.org/opentofu/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -7,7 +7,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/null",
|
||||
"provider_name": "registry.opentofu.org/opentofu/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
@ -27,7 +27,7 @@
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/null": {
|
||||
"registry.opentofu.org/opentofu/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -7,7 +7,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/null",
|
||||
"provider_name": "registry.opentofu.org/opentofu/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
@ -27,7 +27,7 @@
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/null": {
|
||||
"registry.opentofu.org/opentofu/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -1 +1 @@
|
||||
{"format_version":"1.1","terraform_version":"1.4.4","planned_values":{"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/hashicorp/null","schema_version":0,"values":{"triggers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/hashicorp/null","change":{"actions":["create"],"before":null,"after":{"triggers":null},"after_unknown":{"id":true},"before_sensitive":false,"after_sensitive":{}}}],"configuration":{"provider_config":{"null":{"name":"null","full_name":"registry.opentofu.org/hashicorp/null"}},"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_config_key":"null","schema_version":0}]}}}
|
||||
{"format_version":"1.1","terraform_version":"1.4.4","planned_values":{"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/opentofu/null","schema_version":0,"values":{"triggers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/opentofu/null","change":{"actions":["create"],"before":null,"after":{"triggers":null},"after_unknown":{"id":true},"before_sensitive":false,"after_sensitive":{}}}],"configuration":{"provider_config":{"null":{"name":"null","full_name":"registry.opentofu.org/opentofu/null"}},"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_config_key":"null","schema_version":0}]}}}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -7,7 +7,7 @@
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/null",
|
||||
"provider_name": "registry.opentofu.org/opentofu/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"no-op"
|
||||
@ -29,7 +29,7 @@
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/null": {
|
||||
"registry.opentofu.org/opentofu/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -1 +1 @@
|
||||
{"format_version":"1.1","terraform_version":"1.4.4","planned_values":{"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/hashicorp/null","schema_version":0,"values":{"id":"3549869958859575216","triggers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/hashicorp/null","change":{"actions":["no-op"],"before":{"id":"3549869958859575216","triggers":null},"after":{"id":"3549869958859575216","triggers":null},"after_unknown":{},"before_sensitive":{},"after_sensitive":{}}}],"prior_state":{"format_version":"1.0","terraform_version":"1.4.4","values":{"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/hashicorp/null","schema_version":0,"values":{"id":"3549869958859575216","triggers":null},"sensitive_values":{}}]}}},"configuration":{"provider_config":{"null":{"name":"null","full_name":"registry.opentofu.org/hashicorp/null"}},"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_config_key":"null","schema_version":0}]}}}
|
||||
{"format_version":"1.1","terraform_version":"1.4.4","planned_values":{"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/opentofu/null","schema_version":0,"values":{"id":"3549869958859575216","triggers":null},"sensitive_values":{}}]}},"resource_changes":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/opentofu/null","change":{"actions":["no-op"],"before":{"id":"3549869958859575216","triggers":null},"after":{"id":"3549869958859575216","triggers":null},"after_unknown":{},"before_sensitive":{},"after_sensitive":{}}}],"prior_state":{"format_version":"1.0","terraform_version":"1.4.4","values":{"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_name":"registry.opentofu.org/opentofu/null","schema_version":0,"values":{"id":"3549869958859575216","triggers":null},"sensitive_values":{}}]}}},"configuration":{"provider_config":{"null":{"name":"null","full_name":"registry.opentofu.org/opentofu/null"}},"root_module":{"resources":[{"address":"null_resource.foo","mode":"managed","type":"null_resource","name":"foo","provider_config_key":"null","schema_version":0}]}}}
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"testing"
|
||||
@ -58,6 +59,12 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func skipIfTFENotEnabled(t *testing.T) {
|
||||
if os.Getenv("TF_TFC_TEST") == "" {
|
||||
t.Skip("this test accesses app.terraform.io; set TF_TFC_TEST=1 to run it")
|
||||
}
|
||||
}
|
||||
|
||||
// mockInput is a mock implementation of tofu.UIInput.
|
||||
type mockInput struct {
|
||||
answers map[string]string
|
||||
@ -90,7 +97,7 @@ func testBackendWithName(t *testing.T) (*Cloud, func()) {
|
||||
func testBackendAndMocksWithName(t *testing.T) (*Cloud, *MockClient, func()) {
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal(testBackendSingleWorkspaceName),
|
||||
@ -104,7 +111,7 @@ func testBackendAndMocksWithName(t *testing.T) (*Cloud, *MockClient, func()) {
|
||||
func testBackendWithTags(t *testing.T) (*Cloud, func()) {
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.NullVal(cty.String),
|
||||
@ -138,7 +145,7 @@ func testBackendNoOperations(t *testing.T) (*Cloud, func()) {
|
||||
func testBackendWithHandlers(t *testing.T, handlers map[string]func(http.ResponseWriter, *http.Request)) (*Cloud, func()) {
|
||||
obj := cty.ObjectVal(map[string]cty.Value{
|
||||
"hostname": cty.StringVal("app.terraform.io"),
|
||||
"organization": cty.StringVal("hashicorp"),
|
||||
"organization": cty.StringVal("opentofu"),
|
||||
"token": cty.NullVal(cty.String),
|
||||
"workspaces": cty.ObjectVal(map[string]cty.Value{
|
||||
"name": cty.StringVal(testBackendSingleWorkspaceName),
|
||||
@ -225,6 +232,8 @@ func testBackendWithOutputs(t *testing.T) (*Cloud, func()) {
|
||||
}
|
||||
|
||||
func testBackend(t *testing.T, obj cty.Value, handlers map[string]func(http.ResponseWriter, *http.Request)) (*Cloud, *MockClient, func()) {
|
||||
skipIfTFENotEnabled(t)
|
||||
|
||||
var s *httptest.Server
|
||||
if handlers != nil {
|
||||
s = testServerWithHandlers(handlers)
|
||||
@ -378,6 +387,8 @@ func testLocalBackend(t *testing.T, cloud *Cloud) backend.Enhanced {
|
||||
// testServer returns a started *httptest.Server used for local testing with the default set of
|
||||
// request handlers.
|
||||
func testServer(t *testing.T) *httptest.Server {
|
||||
skipIfTFENotEnabled(t)
|
||||
|
||||
return testServerWithHandlers(testDefaultRequestHandlers)
|
||||
}
|
||||
|
||||
@ -398,6 +409,8 @@ func testServerWithHandlers(handlers map[string]func(http.ResponseWriter, *http.
|
||||
}
|
||||
|
||||
func testServerWithSnapshotsEnabled(t *testing.T, enabled bool) *httptest.Server {
|
||||
skipIfTFENotEnabled(t)
|
||||
|
||||
var serverURL string
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
t.Log(r.Method, r.URL.String())
|
||||
@ -563,7 +576,7 @@ func mockColorize() *colorstring.Colorize {
|
||||
}
|
||||
|
||||
func mockSROWorkspace(t *testing.T, b *Cloud, workspaceName string) {
|
||||
_, err := b.client.Workspaces.Update(context.Background(), "hashicorp", workspaceName, tfe.WorkspaceUpdateOptions{
|
||||
_, err := b.client.Workspaces.Update(context.Background(), "opentofu", workspaceName, tfe.WorkspaceUpdateOptions{
|
||||
StructuredRunOutputEnabled: tfe.Bool(true),
|
||||
TerraformVersion: tfe.String("1.4.0"),
|
||||
})
|
||||
|
@ -43,8 +43,8 @@ func TestLoadConfig_providerInstallation(t *testing.T) {
|
||||
},
|
||||
|
||||
DevOverrides: map[addrs.Provider]getproviders.PackageLocalDir{
|
||||
addrs.MustParseProviderSourceString("hashicorp/boop"): getproviders.PackageLocalDir(filepath.FromSlash("/tmp/boop")),
|
||||
addrs.MustParseProviderSourceString("hashicorp/blorp"): getproviders.PackageLocalDir(filepath.FromSlash("/tmp/blorp")),
|
||||
addrs.MustParseProviderSourceString("opentofu/boop"): getproviders.PackageLocalDir(filepath.FromSlash("/tmp/boop")),
|
||||
addrs.MustParseProviderSourceString("opentofu/blorp"): getproviders.PackageLocalDir(filepath.FromSlash("/tmp/blorp")),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
provider_installation {
|
||||
dev_overrides {
|
||||
"hashicorp/boop" = "/tmp/bloop/../boop"
|
||||
"hashicorp/blorp" = "/tmp/blorp"
|
||||
"opentofu/boop" = "/tmp/bloop/../boop"
|
||||
"opentofu/blorp" = "/tmp/blorp"
|
||||
}
|
||||
filesystem_mirror {
|
||||
path = "/tmp/example1"
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"provider_installation": {
|
||||
"dev_overrides": {
|
||||
"hashicorp/boop": "/tmp/bloop/../boop",
|
||||
"hashicorp/blorp": "/tmp/blorp"
|
||||
"opentofu/boop": "/tmp/bloop/../boop",
|
||||
"opentofu/blorp": "/tmp/blorp"
|
||||
},
|
||||
"filesystem_mirror": [{
|
||||
"path": "/tmp/example1",
|
||||
|
@ -140,8 +140,8 @@ func testFixturePath(name string) string {
|
||||
func metaOverridesForProvider(p providers.Interface) *testingOverrides {
|
||||
return &testingOverrides{
|
||||
Providers: map[addrs.Provider]providers.Factory{
|
||||
addrs.NewDefaultProvider("test"): providers.FactoryFixed(p),
|
||||
addrs.NewProvider(addrs.DefaultProviderRegistryHost, "hashicorp2", "test"): providers.FactoryFixed(p),
|
||||
addrs.NewDefaultProvider("test"): providers.FactoryFixed(p),
|
||||
addrs.NewProvider(addrs.DefaultProviderRegistryHost, "opentofu2", "test"): providers.FactoryFixed(p),
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -978,10 +978,10 @@ func mustResourceAddr(s string) addrs.ConfigResource {
|
||||
// when called via LookupLegacyProvider. Providers not in this map will return
|
||||
// a 404 Not Found error.
|
||||
var legacyProviderNamespaces = map[string]string{
|
||||
"foo": "hashicorp",
|
||||
"bar": "hashicorp",
|
||||
"foo": "opentofu",
|
||||
"bar": "opentofu",
|
||||
"baz": "terraform-providers",
|
||||
"qux": "hashicorp",
|
||||
"qux": "opentofu",
|
||||
}
|
||||
|
||||
// This map is used to mock the provider redirect feature.
|
||||
|
@ -25,7 +25,7 @@ func TestPlanApplyInAutomation(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "full-workflow-null")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// We advertise that _any_ non-empty value works, so we'll test something
|
||||
// unconventional here.
|
||||
@ -39,11 +39,11 @@ func TestPlanApplyInAutomation(t *testing.T) {
|
||||
|
||||
// Make sure we actually downloaded the plugins, rather than picking up
|
||||
// copies that might be already installed globally on the system.
|
||||
if !strings.Contains(stdout, "Installing hashicorp/template v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/template v") {
|
||||
t.Errorf("template provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
if !strings.Contains(stdout, "Installing hashicorp/null v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/null v") {
|
||||
t.Errorf("null provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
@ -132,7 +132,7 @@ func TestAutoApplyInAutomation(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "full-workflow-null")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// We advertise that _any_ non-empty value works, so we'll test something
|
||||
// unconventional here.
|
||||
@ -146,11 +146,11 @@ func TestAutoApplyInAutomation(t *testing.T) {
|
||||
|
||||
// Make sure we actually downloaded the plugins, rather than picking up
|
||||
// copies that might be already installed globally on the system.
|
||||
if !strings.Contains(stdout, "Installing hashicorp/template v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/template v") {
|
||||
t.Errorf("template provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
if !strings.Contains(stdout, "Installing hashicorp/null v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/null v") {
|
||||
t.Errorf("null provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
@ -198,7 +198,7 @@ func TestPlanOnlyInAutomation(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "full-workflow-null")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// We advertise that _any_ non-empty value works, so we'll test something
|
||||
// unconventional here.
|
||||
@ -212,11 +212,11 @@ func TestPlanOnlyInAutomation(t *testing.T) {
|
||||
|
||||
// Make sure we actually downloaded the plugins, rather than picking up
|
||||
// copies that might be already installed globally on the system.
|
||||
if !strings.Contains(stdout, "Installing hashicorp/template v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/template v") {
|
||||
t.Errorf("template provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
if !strings.Contains(stdout, "Installing hashicorp/null v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/null v") {
|
||||
t.Errorf("null provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ func TestInitProviders(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "template-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
stdout, stderr, err := tf.Run("init")
|
||||
if err != nil {
|
||||
@ -43,7 +43,7 @@ func TestInitProviders(t *testing.T) {
|
||||
t.Errorf("success message is missing from output:\n%s", stdout)
|
||||
}
|
||||
|
||||
if !strings.Contains(stdout, "- Installing hashicorp/template v") {
|
||||
if !strings.Contains(stdout, "- Installing opentofu/template v") {
|
||||
t.Errorf("provider download message is missing from output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
@ -61,7 +61,7 @@ func TestInitProvidersInternal(t *testing.T) {
|
||||
// provider is internal to the core tofu binary.
|
||||
|
||||
fixturePath := filepath.Join("testdata", "tf-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
stdout, stderr, err := tf.Run("init")
|
||||
if err != nil {
|
||||
@ -76,7 +76,7 @@ func TestInitProvidersInternal(t *testing.T) {
|
||||
t.Errorf("success message is missing from output:\n%s", stdout)
|
||||
}
|
||||
|
||||
if strings.Contains(stdout, "Installing hashicorp/terraform") {
|
||||
if strings.Contains(stdout, "Installing opentofu/terraform") {
|
||||
// Shouldn't have downloaded anything with this config, because the
|
||||
// provider is built in.
|
||||
t.Errorf("provider download message appeared in output:\n%s", stdout)
|
||||
@ -94,19 +94,19 @@ func TestInitProvidersVendored(t *testing.T) {
|
||||
|
||||
// This test will try to reach out to registry.opentofu.org as one of the
|
||||
// possible installation locations for
|
||||
// hashicorp/null, where it will find that
|
||||
// opentofu/null, where it will find that
|
||||
// versions do exist but will ultimately select the version that is
|
||||
// vendored due to the version constraint.
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "vendored-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// Our fixture dir has a generic os_arch dir, which we need to customize
|
||||
// to the actual OS/arch where this test is running in order to get the
|
||||
// desired result.
|
||||
fixtMachineDir := tf.Path("terraform.d/plugins/registry.opentofu.org/hashicorp/null/1.0.0+local/os_arch")
|
||||
wantMachineDir := tf.Path("terraform.d/plugins/registry.opentofu.org/hashicorp/null/1.0.0+local/", fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||
fixtMachineDir := tf.Path("terraform.d/plugins/registry.opentofu.org/opentofu/null/1.0.0+local/os_arch")
|
||||
wantMachineDir := tf.Path("terraform.d/plugins/registry.opentofu.org/opentofu/null/1.0.0+local/", fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||
err := os.Rename(fixtMachineDir, wantMachineDir)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
@ -125,7 +125,7 @@ func TestInitProvidersVendored(t *testing.T) {
|
||||
t.Errorf("success message is missing from output:\n%s", stdout)
|
||||
}
|
||||
|
||||
if !strings.Contains(stdout, "- Installing hashicorp/null v1.0.0+local") {
|
||||
if !strings.Contains(stdout, "- Installing opentofu/null v1.0.0+local") {
|
||||
t.Errorf("provider download message is missing from output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
@ -143,7 +143,7 @@ func TestInitProvidersLocalOnly(t *testing.T) {
|
||||
// the test fixture.)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "local-only-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
// If you run this test on a workstation with a plugin-cache directory
|
||||
// configured, it will leave a bad directory behind and tofu init will
|
||||
// not work until you remove it.
|
||||
@ -193,7 +193,7 @@ func TestInitProvidersCustomMethod(t *testing.T) {
|
||||
for _, configFile := range []string{"cliconfig.tfrc", "cliconfig.tfrc.json"} {
|
||||
t.Run(configFile, func(t *testing.T) {
|
||||
fixturePath := filepath.Join("testdata", "custom-provider-install-method")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// Our fixture dir has a generic os_arch dir, which we need to customize
|
||||
// to the actual OS/arch where this test is running in order to get the
|
||||
@ -238,13 +238,13 @@ func TestInitProviders_pluginCache(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "plugin-cache")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// Our fixture dir has a generic os_arch dir, which we need to customize
|
||||
// to the actual OS/arch where this test is running in order to get the
|
||||
// desired result.
|
||||
fixtMachineDir := tf.Path("cache/registry.opentofu.org/hashicorp/template/2.1.0/os_arch")
|
||||
wantMachineDir := tf.Path("cache/registry.opentofu.org/hashicorp/template/2.1.0/", fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||
fixtMachineDir := tf.Path("cache/registry.opentofu.org/opentofu/template/2.1.0/os_arch")
|
||||
wantMachineDir := tf.Path("cache/registry.opentofu.org/opentofu/template/2.1.0/", fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||
err := os.Rename(fixtMachineDir, wantMachineDir)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
@ -260,7 +260,7 @@ func TestInitProviders_pluginCache(t *testing.T) {
|
||||
t.Errorf("unexpected error: %s", err)
|
||||
}
|
||||
|
||||
path := filepath.FromSlash(fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/template/2.1.0/%s_%s/terraform-provider-template_v2.1.0_x4", runtime.GOOS, runtime.GOARCH))
|
||||
path := filepath.FromSlash(fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/template/2.1.0/%s_%s/terraform-provider-template_v2.1.0_x4", runtime.GOOS, runtime.GOARCH))
|
||||
content, err := tf.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read installed plugin from %s: %s", path, err)
|
||||
@ -269,7 +269,7 @@ func TestInitProviders_pluginCache(t *testing.T) {
|
||||
t.Errorf("template plugin was not installed from local cache")
|
||||
}
|
||||
|
||||
nullLinkPath := filepath.FromSlash(fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/null/2.1.0/%s_%s/terraform-provider-null", runtime.GOOS, runtime.GOARCH))
|
||||
nullLinkPath := filepath.FromSlash(fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/null/2.1.0/%s_%s/terraform-provider-null", runtime.GOOS, runtime.GOARCH))
|
||||
if runtime.GOOS == "windows" {
|
||||
nullLinkPath = nullLinkPath + ".exe"
|
||||
}
|
||||
@ -277,7 +277,7 @@ func TestInitProviders_pluginCache(t *testing.T) {
|
||||
t.Errorf("null plugin was not installed into %s", nullLinkPath)
|
||||
}
|
||||
|
||||
nullCachePath := filepath.FromSlash(fmt.Sprintf("cache/registry.opentofu.org/hashicorp/null/2.1.0/%s_%s/terraform-provider-null", runtime.GOOS, runtime.GOARCH))
|
||||
nullCachePath := filepath.FromSlash(fmt.Sprintf("cache/registry.opentofu.org/opentofu/null/2.1.0/%s_%s/terraform-provider-null", runtime.GOOS, runtime.GOARCH))
|
||||
if runtime.GOOS == "windows" {
|
||||
nullCachePath = nullCachePath + ".exe"
|
||||
}
|
||||
@ -294,7 +294,7 @@ func TestInit_fromModule(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "empty")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
cmd := tf.Cmd("init", "-from-module=hashicorp/vault/aws")
|
||||
cmd.Stdin = nil
|
||||
@ -323,11 +323,11 @@ func TestInitProviderNotFound(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// This test will reach out to registry.opentofu.org as one of the possible
|
||||
// installation locations for hashicorp/nonexist, which should not exist.
|
||||
// installation locations for opentofu/nonexist, which should not exist.
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "provider-not-found")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
t.Run("registry provider not found", func(t *testing.T) {
|
||||
_, stderr, err := tf.Run("init", "-no-color")
|
||||
@ -336,7 +336,7 @@ func TestInitProviderNotFound(t *testing.T) {
|
||||
}
|
||||
|
||||
oneLineStderr := strings.ReplaceAll(stderr, "\n", " ")
|
||||
if !strings.Contains(oneLineStderr, "provider registry registry.opentofu.org does not have a provider named registry.opentofu.org/hashicorp/nonexist") {
|
||||
if !strings.Contains(oneLineStderr, "provider registry registry.opentofu.org does not have a provider named registry.opentofu.org/opentofu/nonexist") {
|
||||
t.Errorf("expected error message is missing from output:\n%s", stderr)
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ func TestInitProviderNotFound(t *testing.T) {
|
||||
t.Fatal("expected error, got success")
|
||||
}
|
||||
|
||||
if !strings.Contains(stderr, "provider registry.opentofu.org/hashicorp/nonexist was not\nfound in any of the search locations\n\n - "+pluginDir) {
|
||||
if !strings.Contains(stderr, "provider registry.opentofu.org/opentofu/nonexist was not\nfound in any of the search locations\n\n - "+pluginDir) {
|
||||
t.Errorf("expected error message is missing from output:\n%s", stderr)
|
||||
}
|
||||
})
|
||||
@ -372,12 +372,12 @@ func TestInitProviderNotFound(t *testing.T) {
|
||||
│ Error: Failed to query available provider packages
|
||||
│` + ` ` + `
|
||||
│ Could not retrieve the list of available versions for provider
|
||||
│ hashicorp/nonexist: provider registry registry.opentofu.org does not have a
|
||||
│ provider named registry.opentofu.org/hashicorp/nonexist
|
||||
│ opentofu/nonexist: provider registry registry.opentofu.org does not have a
|
||||
│ provider named registry.opentofu.org/opentofu/nonexist
|
||||
│
|
||||
│ All modules should specify their required_providers so that external
|
||||
│ consumers will get the correct providers when using a module. To see which
|
||||
│ modules are currently depending on hashicorp/nonexist, run the following
|
||||
│ modules are currently depending on opentofu/nonexist, run the following
|
||||
│ command:
|
||||
│ tofu providers
|
||||
│
|
||||
@ -402,7 +402,7 @@ func TestInitProviderNotFound(t *testing.T) {
|
||||
// skipIfCannotAccessNetwork(t)
|
||||
//
|
||||
// fixturePath := filepath.Join("testdata", "provider-warnings")
|
||||
// tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
// tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
//
|
||||
// stdout, _, err := tf.Run("init")
|
||||
// if err == nil {
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/e2e"
|
||||
)
|
||||
|
||||
var terraformBin string
|
||||
var tofuBin string
|
||||
|
||||
// canRunGoBuild is a short-term compromise to account for the fact that we
|
||||
// have a small number of tests that work by building helper programs using
|
||||
@ -23,7 +23,7 @@ var terraformBin string
|
||||
// (test plugins, etc) as part of the initial suite setup, and in the
|
||||
// make-archive.sh script, so that we can run all of the tests in both
|
||||
// situations with the tests just using the executable already built for
|
||||
// them, as we do for terraformBin.
|
||||
// them, as we do for tofuBin.
|
||||
var canRunGoBuild bool
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@ -34,14 +34,14 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func setup() func() {
|
||||
if terraformBin != "" {
|
||||
if tofuBin != "" {
|
||||
// this is pre-set when we're running in a binary produced from
|
||||
// the make-archive.sh script, since that is for testing an
|
||||
// executable obtained from a real release package. However, we do
|
||||
// need to turn it into an absolute path so that we can find it
|
||||
// when we change the working directory during tests.
|
||||
var err error
|
||||
terraformBin, err = filepath.Abs(terraformBin)
|
||||
tofuBin, err = filepath.Abs(tofuBin)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to find absolute path of tofu executable: %s", err))
|
||||
}
|
||||
@ -51,7 +51,7 @@ func setup() func() {
|
||||
tmpFilename := e2e.GoBuild("github.com/opentofu/opentofu/cmd/tofu", "tofu")
|
||||
|
||||
// Make the executable available for use in tests
|
||||
terraformBin = tmpFilename
|
||||
tofuBin = tmpFilename
|
||||
|
||||
// Tests running in the ad-hoc testing mode are allowed to use "go build"
|
||||
// and similar to produce other test executables.
|
||||
|
@ -34,7 +34,7 @@ GOEXE="$(go env GOEXE)"
|
||||
OUTDIR="build/${GOOS}_${GOARCH}"
|
||||
OUTFILE="tofu-e2etest_${GOOS}_${GOARCH}.zip"
|
||||
|
||||
LDFLAGS="-X github.com/opentofu/opentofu/internal/command/e2etest.terraformBin=./tofu$GOEXE"
|
||||
LDFLAGS="-X github.com/opentofu/opentofu/internal/command/e2etest.tofuBin=./tofu$GOEXE"
|
||||
# Caller may pass in the environment variable GO_LDFLAGS with additional
|
||||
# flags we'll use when building.
|
||||
if [ -n "${GO_LDFLAGS+set}" ]; then
|
||||
|
@ -18,7 +18,7 @@ func TestInitModuleArchive(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "module-archive")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
stdout, stderr, err := tf.Run("init")
|
||||
if err != nil {
|
||||
|
@ -32,7 +32,7 @@ func TestPrimarySeparatePlan(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "full-workflow-null")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
//// INIT
|
||||
stdout, stderr, err := tf.Run("init")
|
||||
@ -42,11 +42,11 @@ func TestPrimarySeparatePlan(t *testing.T) {
|
||||
|
||||
// Make sure we actually downloaded the plugins, rather than picking up
|
||||
// copies that might be already installed globally on the system.
|
||||
if !strings.Contains(stdout, "Installing hashicorp/template v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/template v") {
|
||||
t.Errorf("template provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
if !strings.Contains(stdout, "Installing hashicorp/null v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/null v") {
|
||||
t.Errorf("null provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
@ -152,7 +152,7 @@ func TestPrimaryChdirOption(t *testing.T) {
|
||||
// safe to run it even when network access is disallowed.
|
||||
|
||||
fixturePath := filepath.Join("testdata", "chdir-option")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
//// INIT
|
||||
_, stderr, err := tf.Run("-chdir=subdir", "init")
|
||||
|
@ -30,7 +30,7 @@ func TestProviderDevOverrides(t *testing.T) {
|
||||
}
|
||||
t.Parallel()
|
||||
|
||||
tf := e2e.NewBinary(t, terraformBin, "testdata/provider-dev-override")
|
||||
tf := e2e.NewBinary(t, tofuBin, "testdata/provider-dev-override")
|
||||
|
||||
// In order to do a decent end-to-end test for this case we will need a
|
||||
// real enough provider plugin to try to run and make sure we are able
|
||||
|
@ -26,7 +26,7 @@ func TestProviderProtocols(t *testing.T) {
|
||||
}
|
||||
t.Parallel()
|
||||
|
||||
tf := e2e.NewBinary(t, terraformBin, "testdata/provider-plugin")
|
||||
tf := e2e.NewBinary(t, tofuBin, "testdata/provider-plugin")
|
||||
|
||||
// In order to do a decent end-to-end test for this case we will need a real
|
||||
// enough provider plugin to try to run and make sure we are able to
|
||||
@ -41,7 +41,7 @@ func TestProviderProtocols(t *testing.T) {
|
||||
// Move the provider binaries into a directory that we will point tofu
|
||||
// to using the -plugin-dir cli flag.
|
||||
platform := getproviders.CurrentPlatform.String()
|
||||
hashiDir := "cache/registry.opentofu.org/hashicorp/"
|
||||
hashiDir := "cache/registry.opentofu.org/opentofu/"
|
||||
if err := os.MkdirAll(tf.Path(hashiDir, "simple6/0.0.1/", platform), os.ModePerm); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func testTerraformProvidersMirror(t *testing.T, fixture string) {
|
||||
t.Logf("creating mirror directory in %s", outputDir)
|
||||
|
||||
fixturePath := filepath.Join("testdata", fixture)
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
stdout, stderr, err := tf.Run("providers", "mirror", "-platform=linux_amd64", "-platform=windows_386", outputDir)
|
||||
if err != nil {
|
||||
@ -49,14 +49,14 @@ func testTerraformProvidersMirror(t *testing.T, fixture string) {
|
||||
// In the (unlikely) event that these particular versions of these
|
||||
// providers are removed from the registry, this test will start to fail.
|
||||
want := []string{
|
||||
"registry.opentofu.org/hashicorp/null/2.1.0.json",
|
||||
"registry.opentofu.org/hashicorp/null/index.json",
|
||||
"registry.opentofu.org/hashicorp/null/terraform-provider-null_2.1.0_linux_amd64.zip",
|
||||
"registry.opentofu.org/hashicorp/null/terraform-provider-null_2.1.0_windows_386.zip",
|
||||
"registry.opentofu.org/hashicorp/template/2.1.1.json",
|
||||
"registry.opentofu.org/hashicorp/template/index.json",
|
||||
"registry.opentofu.org/hashicorp/template/terraform-provider-template_2.1.1_linux_amd64.zip",
|
||||
"registry.opentofu.org/hashicorp/template/terraform-provider-template_2.1.1_windows_386.zip",
|
||||
"registry.opentofu.org/opentofu/null/2.1.0.json",
|
||||
"registry.opentofu.org/opentofu/null/index.json",
|
||||
"registry.opentofu.org/opentofu/null/terraform-provider-null_2.1.0_linux_amd64.zip",
|
||||
"registry.opentofu.org/opentofu/null/terraform-provider-null_2.1.0_windows_386.zip",
|
||||
"registry.opentofu.org/opentofu/template/2.1.1.json",
|
||||
"registry.opentofu.org/opentofu/template/index.json",
|
||||
"registry.opentofu.org/opentofu/template/terraform-provider-template_2.1.1_linux_amd64.zip",
|
||||
"registry.opentofu.org/opentofu/template/terraform-provider-template_2.1.1_windows_386.zip",
|
||||
}
|
||||
var got []string
|
||||
walkErr := filepath.Walk(outputDir, func(path string, info os.FileInfo, err error) error {
|
||||
|
@ -29,20 +29,20 @@ func TestProviderTampering(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "provider-tampering-base")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
stdout, stderr, err := tf.Run("init")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected init error: %s\nstderr:\n%s", err, stderr)
|
||||
}
|
||||
if !strings.Contains(stdout, "Installing hashicorp/null v") {
|
||||
if !strings.Contains(stdout, "Installing opentofu/null v") {
|
||||
t.Errorf("null provider download message is missing from init output:\n%s", stdout)
|
||||
t.Logf("(this can happen if you have a copy of the plugin in one of the global plugin search dirs)")
|
||||
}
|
||||
|
||||
seedDir := tf.WorkDir()
|
||||
const providerVersion = "3.1.0" // must match the version in the fixture config
|
||||
pluginDir := filepath.Join(".terraform", "providers", "registry.opentofu.org", "hashicorp", "null", providerVersion, getproviders.CurrentPlatform.String())
|
||||
pluginDir := filepath.Join(".terraform", "providers", "registry.opentofu.org", "opentofu", "null", providerVersion, getproviders.CurrentPlatform.String())
|
||||
pluginExe := filepath.Join(pluginDir, "terraform-provider-null_v"+providerVersion+"_x5")
|
||||
if getproviders.CurrentPlatform.OS == "windows" {
|
||||
pluginExe += ".exe" // ugh
|
||||
@ -53,7 +53,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
providerCacheDir := filepath.Join(".terraform", "providers")
|
||||
|
||||
t.Run("cache dir totally gone", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
err := os.RemoveAll(filepath.Join(workDir, ".terraform"))
|
||||
@ -65,7 +65,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected plan success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `registry.opentofu.org/hashicorp/null: there is no package for registry.opentofu.org/hashicorp/null 3.1.0 cached in ` + providerCacheDir; !strings.Contains(stderr, want) {
|
||||
if want := `registry.opentofu.org/opentofu/null: there is no package for registry.opentofu.org/opentofu/null 3.1.0 cached in ` + providerCacheDir; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
@ -83,7 +83,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("cache dir totally gone, explicit backend", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
err := os.WriteFile(filepath.Join(workDir, "backend.tf"), []byte(localBackendConfig), 0600)
|
||||
@ -118,7 +118,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("null plugin package modified before plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
err := os.WriteFile(filepath.Join(workDir, pluginExe), []byte("tamper"), 0600)
|
||||
@ -130,7 +130,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected plan success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `registry.opentofu.org/hashicorp/null: the cached package for registry.opentofu.org/hashicorp/null 3.1.0 (in ` + providerCacheDir + `) does not match any of the checksums recorded in the dependency lock file`; !strings.Contains(stderr, want) {
|
||||
if want := `registry.opentofu.org/opentofu/null: the cached package for registry.opentofu.org/opentofu/null 3.1.0 (in ` + providerCacheDir + `) does not match any of the checksums recorded in the dependency lock file`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
@ -138,14 +138,14 @@ func TestProviderTampering(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("version constraint changed in config before plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
err := os.WriteFile(filepath.Join(workDir, "provider-tampering-base.tf"), []byte(`
|
||||
terraform {
|
||||
required_providers {
|
||||
null = {
|
||||
source = "hashicorp/null"
|
||||
source = "opentofu/null"
|
||||
version = "1.0.0"
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected plan success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `provider registry.opentofu.org/hashicorp/null: locked version selection 3.1.0 doesn't match the updated version constraints "1.0.0"`; !strings.Contains(stderr, want) {
|
||||
if want := `provider registry.opentofu.org/opentofu/null: locked version selection 3.1.0 doesn't match the updated version constraints "1.0.0"`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `tofu init -upgrade`; !strings.Contains(stderr, want) {
|
||||
@ -167,7 +167,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("lock file modified before plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
// NOTE: We're just emptying out the lock file here because that's
|
||||
@ -185,7 +185,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected plan success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `provider registry.opentofu.org/hashicorp/null: required by this configuration but no version is selected`; !strings.Contains(stderr, want) {
|
||||
if want := `provider registry.opentofu.org/opentofu/null: required by this configuration but no version is selected`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `tofu init`; !strings.Contains(stderr, want) {
|
||||
@ -193,7 +193,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("lock file modified after plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
_, stderr, err := tf.Run("plan", "-out", "tfplan")
|
||||
@ -210,7 +210,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected apply success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `provider registry.opentofu.org/hashicorp/null: required by this configuration but no version is selected`; !strings.Contains(stderr, want) {
|
||||
if want := `provider registry.opentofu.org/opentofu/null: required by this configuration but no version is selected`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
if want := `Create a new plan from the updated configuration.`; !strings.Contains(stderr, want) {
|
||||
@ -218,7 +218,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("plugin cache dir entirely removed after plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
_, stderr, err := tf.Run("plan", "-out", "tfplan")
|
||||
@ -235,12 +235,12 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected apply success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `registry.opentofu.org/hashicorp/null: there is no package for registry.opentofu.org/hashicorp/null 3.1.0 cached in ` + providerCacheDir; !strings.Contains(stderr, want) {
|
||||
if want := `registry.opentofu.org/opentofu/null: there is no package for registry.opentofu.org/opentofu/null 3.1.0 cached in ` + providerCacheDir; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
})
|
||||
t.Run("null plugin package modified after plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(t, terraformBin, seedDir)
|
||||
tf := e2e.NewBinary(t, tofuBin, seedDir)
|
||||
workDir := tf.WorkDir()
|
||||
|
||||
_, stderr, err := tf.Run("plan", "-out", "tfplan")
|
||||
@ -257,7 +257,7 @@ func TestProviderTampering(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected apply success\nstdout:\n%s", stdout)
|
||||
}
|
||||
if want := `registry.opentofu.org/hashicorp/null: the cached package for registry.opentofu.org/hashicorp/null 3.1.0 (in ` + providerCacheDir + `) does not match any of the checksums recorded in the dependency lock file`; !strings.Contains(stderr, want) {
|
||||
if want := `registry.opentofu.org/opentofu/null: the cached package for registry.opentofu.org/opentofu/null 3.1.0 (in ` + providerCacheDir + `) does not match any of the checksums recorded in the dependency lock file`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ func TestProvisionerPlugin(t *testing.T) {
|
||||
// allowed.
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
tf := e2e.NewBinary(t, terraformBin, "testdata/provisioner-plugin")
|
||||
tf := e2e.NewBinary(t, tofuBin, "testdata/provisioner-plugin")
|
||||
|
||||
// In order to do a decent end-to-end test for this case we will need a
|
||||
// real enough provisioner plugin to try to run and make sure we are able
|
||||
|
@ -20,7 +20,7 @@ func TestProvisioner(t *testing.T) {
|
||||
// allowed.
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
tf := e2e.NewBinary(t, terraformBin, "testdata/provisioner")
|
||||
tf := e2e.NewBinary(t, tofuBin, "testdata/provisioner")
|
||||
|
||||
//// INIT
|
||||
_, stderr, err := tf.Run("init")
|
||||
|
@ -15,7 +15,7 @@ func TestTerraformProviderRead(t *testing.T) {
|
||||
|
||||
t.Parallel()
|
||||
fixturePath := filepath.Join("testdata", "tf-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
//// INIT
|
||||
_, stderr, err := tf.Run("init")
|
||||
|
@ -20,7 +20,7 @@ func TestMultipleRunBlocks(t *testing.T) {
|
||||
|
||||
go func() {
|
||||
fixturePath := filepath.Join("testdata", "multiple-run-blocks")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
stdout, stderr, err := tf.Run("test")
|
||||
done <- &testResult{
|
||||
stdout: stdout,
|
||||
|
@ -6,7 +6,7 @@
|
||||
# under the "cache" directory, rather than the real provider from upstream,
|
||||
# so that Terraform CLI will consider the cache entry as valid.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/template" {
|
||||
provider "registry.opentofu.org/opentofu/template" {
|
||||
version = "2.1.0"
|
||||
hashes = [
|
||||
"h1:e7YvVlRZlaZJ8ED5KnH0dAg0kPL0nAU7eEoCAZ/sOos=",
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
nonexist = {
|
||||
source = "registry.opentofu.org/hashicorp/nonexist"
|
||||
source = "registry.opentofu.org/opentofu/nonexist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
simple5 = {
|
||||
source = "registry.opentofu.org/hashicorp/simple"
|
||||
source = "registry.opentofu.org/opentofu/simple"
|
||||
}
|
||||
simple6 = {
|
||||
source = "registry.opentofu.org/hashicorp/simple6"
|
||||
source = "registry.opentofu.org/opentofu/simple6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ terraform {
|
||||
# test case here, though we might have to update this in future
|
||||
# if e.g. Terraform stops supporting plugin protocol 5, or if
|
||||
# the null provider is yanked from the registry for some reason.
|
||||
source = "hashicorp/null"
|
||||
source = "opentofu/null"
|
||||
version = "3.1.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
terraform = {
|
||||
// hashicorp/terraform is published in the registry, but it is
|
||||
// opentofu/terraform is published in the registry, but it is
|
||||
// archived (since it is internal) and returns a warning:
|
||||
//
|
||||
// "This provider is archived and no longer needed. The terraform_remote_state
|
||||
// data source is built into the latest Terraform release."
|
||||
source = "hashicorp/terraform"
|
||||
source = "opentofu/terraform"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
simple = {
|
||||
source = "hashicorp/test"
|
||||
source = "opentofu/test"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/null" {
|
||||
provider "registry.opentofu.org/opentofu/null" {
|
||||
version = "2.1.0"
|
||||
constraints = "2.1.0"
|
||||
hashes = [
|
||||
@ -22,7 +22,7 @@ provider "registry.opentofu.org/hashicorp/null" {
|
||||
]
|
||||
}
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/template" {
|
||||
provider "registry.opentofu.org/opentofu/template" {
|
||||
version = "2.1.1"
|
||||
constraints = "2.1.1"
|
||||
hashes = [
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
template = { source = "hashicorp/template" }
|
||||
null = { source = "hashicorp/null" }
|
||||
template = { source = "opentofu/template" }
|
||||
null = { source = "opentofu/null" }
|
||||
terraform = { source = "terraform.io/builtin/terraform" }
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
template = { version = "2.1.1" }
|
||||
null = { source = "hashicorp/null", version = "2.1.0" }
|
||||
null = { source = "opentofu/null", version = "2.1.0" }
|
||||
terraform = { source = "terraform.io/builtin/terraform" }
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
null = {
|
||||
source = "hashicorp/null"
|
||||
source = "opentofu/null"
|
||||
version = "1.0.0+local"
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
func TestTerraformProviderData(t *testing.T) {
|
||||
|
||||
fixturePath := filepath.Join("testdata", "tofu-managed-data")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
_, stderr, err := tf.Run("init", "-input=false")
|
||||
if err != nil {
|
||||
|
@ -149,7 +149,7 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fixturePath := filepath.Join("testdata", "test-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
reattachCh := make(chan *plugin.ReattachConfig)
|
||||
closeCh := make(chan struct{})
|
||||
@ -185,7 +185,7 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||
t.Fatalf("no reattach config received")
|
||||
}
|
||||
reattachStr, err := json.Marshal(map[string]reattachConfig{
|
||||
"hashicorp/test": {
|
||||
"opentofu/test": {
|
||||
Protocol: string(config.Protocol),
|
||||
ProtocolVersion: 6,
|
||||
Pid: config.Pid,
|
||||
@ -209,10 +209,10 @@ func TestUnmanagedSeparatePlan(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make sure we didn't download the binary
|
||||
if strings.Contains(stdout, "Installing hashicorp/test v") {
|
||||
if strings.Contains(stdout, "Installing opentofu/test v") {
|
||||
t.Errorf("test provider download message is present in init output:\n%s", stdout)
|
||||
}
|
||||
if tf.FileExists(filepath.Join(".terraform", "plugins", "registry.opentofu.org", "hashicorp", "test")) {
|
||||
if tf.FileExists(filepath.Join(".terraform", "plugins", "registry.opentofu.org", "opentofu", "test")) {
|
||||
t.Errorf("test provider binary found in .terraform dir")
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ func TestUnmanagedSeparatePlan_proto5(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fixturePath := filepath.Join("testdata", "test-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
reattachCh := make(chan *plugin.ReattachConfig)
|
||||
closeCh := make(chan struct{})
|
||||
@ -290,7 +290,7 @@ func TestUnmanagedSeparatePlan_proto5(t *testing.T) {
|
||||
t.Fatalf("no reattach config received")
|
||||
}
|
||||
reattachStr, err := json.Marshal(map[string]reattachConfig{
|
||||
"hashicorp/test": {
|
||||
"opentofu/test": {
|
||||
Protocol: string(config.Protocol),
|
||||
ProtocolVersion: 5,
|
||||
Pid: config.Pid,
|
||||
@ -314,10 +314,10 @@ func TestUnmanagedSeparatePlan_proto5(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make sure we didn't download the binary
|
||||
if strings.Contains(stdout, "Installing hashicorp/test v") {
|
||||
if strings.Contains(stdout, "Installing opentofu/test v") {
|
||||
t.Errorf("test provider download message is present in init output:\n%s", stdout)
|
||||
}
|
||||
if tf.FileExists(filepath.Join(".terraform", "plugins", "registry.opentofu.org", "hashicorp", "test")) {
|
||||
if tf.FileExists(filepath.Join(".terraform", "plugins", "registry.opentofu.org", "opentofu", "test")) {
|
||||
t.Errorf("test provider binary found in .terraform dir")
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ func TestVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fixturePath := filepath.Join("testdata", "empty")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
stdout, stderr, err := tf.Run("version")
|
||||
if err != nil {
|
||||
@ -50,7 +50,7 @@ func TestVersionWithProvider(t *testing.T) {
|
||||
skipIfCannotAccessNetwork(t)
|
||||
|
||||
fixturePath := filepath.Join("testdata", "template-provider")
|
||||
tf := e2e.NewBinary(t, terraformBin, fixturePath)
|
||||
tf := e2e.NewBinary(t, tofuBin, fixturePath)
|
||||
|
||||
// Initial run (before "init") should work without error but will not
|
||||
// include the provider version, since we've not "locked" one yet.
|
||||
@ -89,7 +89,7 @@ func TestVersionWithProvider(t *testing.T) {
|
||||
t.Errorf("unexpected stderr output:\n%s", stderr)
|
||||
}
|
||||
|
||||
wantMsg := "+ provider registry.opentofu.org/hashicorp/template v" // we don't know which version we'll get here
|
||||
wantMsg := "+ provider registry.opentofu.org/opentofu/template v" // we don't know which version we'll get here
|
||||
if !strings.Contains(stdout, wantMsg) {
|
||||
t.Errorf("output does not contain provider information %q:\n%s", wantMsg, stdout)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ func TestGraph(t *testing.T) {
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
if !strings.Contains(output, `provider[\"registry.opentofu.org/hashicorp/test\"]`) {
|
||||
if !strings.Contains(output, `provider[\"registry.opentofu.org/opentofu/test\"]`) {
|
||||
t.Fatalf("doesn't look like digraph: %s", output)
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,7 @@ func TestGraph_noArgs(t *testing.T) {
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
if !strings.Contains(output, `provider[\"registry.opentofu.org/hashicorp/test\"]`) {
|
||||
if !strings.Contains(output, `provider[\"registry.opentofu.org/opentofu/test\"]`) {
|
||||
t.Fatalf("doesn't look like digraph: %s", output)
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ func TestGraph_plan(t *testing.T) {
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
if !strings.Contains(output, `provider[\"registry.opentofu.org/hashicorp/test\"]`) {
|
||||
if !strings.Contains(output, `provider[\"registry.opentofu.org/opentofu/test\"]`) {
|
||||
t.Fatalf("doesn't look like digraph: %s", output)
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ func TestImport_initializationErrorShouldUnlock(t *testing.T) {
|
||||
|
||||
// specifically, it should fail due to a missing provider
|
||||
msg := strings.ReplaceAll(ui.ErrorWriter.String(), "\n", " ")
|
||||
if want := `provider registry.opentofu.org/hashicorp/unknown: required by this configuration but no version is selected`; !strings.Contains(msg, want) {
|
||||
if want := `provider registry.opentofu.org/opentofu/unknown: required by this configuration but no version is selected`; !strings.Contains(msg, want) {
|
||||
t.Errorf("incorrect message\nwant substring: %s\ngot:\n%s", want, msg)
|
||||
}
|
||||
|
||||
@ -978,5 +978,5 @@ func TestImport_targetIsModule(t *testing.T) {
|
||||
const testImportStr = `
|
||||
test_instance.foo:
|
||||
ID = yay
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
@ -484,7 +484,7 @@ func TestInit_backendReconfigure(t *testing.T) {
|
||||
defer testChdir(t, td)()
|
||||
|
||||
providerSource, close := newMockProviderSource(t, map[string][]string{
|
||||
"hashicorp/test": {"1.2.3"},
|
||||
"opentofu/test": {"1.2.3"},
|
||||
})
|
||||
defer close()
|
||||
|
||||
@ -559,7 +559,7 @@ func TestInit_backendMigrateWhileLocked(t *testing.T) {
|
||||
defer testChdir(t, td)()
|
||||
|
||||
providerSource, close := newMockProviderSource(t, map[string][]string{
|
||||
"hashicorp/test": {"1.2.3"},
|
||||
"opentofu/test": {"1.2.3"},
|
||||
})
|
||||
defer close()
|
||||
|
||||
@ -1343,15 +1343,15 @@ func TestInit_getProvider(t *testing.T) {
|
||||
}
|
||||
|
||||
// check that we got the providers for our config
|
||||
exactPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/exact/1.2.3/%s", getproviders.CurrentPlatform)
|
||||
exactPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/exact/1.2.3/%s", getproviders.CurrentPlatform)
|
||||
if _, err := os.Stat(exactPath); os.IsNotExist(err) {
|
||||
t.Fatal("provider 'exact' not downloaded")
|
||||
}
|
||||
greaterThanPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/greater-than/2.3.4/%s", getproviders.CurrentPlatform)
|
||||
greaterThanPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/greater-than/2.3.4/%s", getproviders.CurrentPlatform)
|
||||
if _, err := os.Stat(greaterThanPath); os.IsNotExist(err) {
|
||||
t.Fatal("provider 'greater-than' not downloaded")
|
||||
}
|
||||
betweenPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/between/2.3.4/%s", getproviders.CurrentPlatform)
|
||||
betweenPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/between/2.3.4/%s", getproviders.CurrentPlatform)
|
||||
if _, err := os.Stat(betweenPath); os.IsNotExist(err) {
|
||||
t.Fatal("provider 'between' not downloaded")
|
||||
}
|
||||
@ -1455,7 +1455,7 @@ func TestInit_getProviderSource(t *testing.T) {
|
||||
if _, err := os.Stat(greaterThanPath); os.IsNotExist(err) {
|
||||
t.Error("provider 'beta' not downloaded")
|
||||
}
|
||||
betweenPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/gamma/2.0.0/%s", getproviders.CurrentPlatform)
|
||||
betweenPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/gamma/2.0.0/%s", getproviders.CurrentPlatform)
|
||||
if _, err := os.Stat(betweenPath); os.IsNotExist(err) {
|
||||
t.Error("provider 'gamma' not downloaded")
|
||||
}
|
||||
@ -1575,7 +1575,7 @@ func TestInit_getProviderDetectedLegacy(t *testing.T) {
|
||||
// unknown provider, and the registry source will allow us to look up the
|
||||
// appropriate namespace if possible.
|
||||
providerSource, psClose := newMockProviderSource(t, map[string][]string{
|
||||
"hashicorp/foo": {"1.2.3"},
|
||||
"opentofu/foo": {"1.2.3"},
|
||||
"terraform-providers/baz": {"2.3.4"}, // this will not be installed
|
||||
})
|
||||
defer psClose()
|
||||
@ -1606,7 +1606,7 @@ func TestInit_getProviderDetectedLegacy(t *testing.T) {
|
||||
}
|
||||
|
||||
// foo should be installed
|
||||
fooPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/hashicorp/foo/1.2.3/%s", getproviders.CurrentPlatform)
|
||||
fooPath := fmt.Sprintf(".terraform/providers/registry.opentofu.org/opentofu/foo/1.2.3/%s", getproviders.CurrentPlatform)
|
||||
if _, err := os.Stat(fooPath); os.IsNotExist(err) {
|
||||
t.Error("provider 'foo' not installed")
|
||||
}
|
||||
@ -1621,8 +1621,8 @@ func TestInit_getProviderDetectedLegacy(t *testing.T) {
|
||||
errors := []string{
|
||||
"Failed to query available provider packages",
|
||||
"Could not retrieve the list of available versions",
|
||||
"registry.opentofu.org/hashicorp/baz",
|
||||
"registry.opentofu.org/hashicorp/frob",
|
||||
"registry.opentofu.org/opentofu/baz",
|
||||
"registry.opentofu.org/opentofu/frob",
|
||||
}
|
||||
for _, want := range errors {
|
||||
if !strings.Contains(errOutput, want) {
|
||||
@ -1706,7 +1706,7 @@ func TestInit_providerSource(t *testing.T) {
|
||||
getproviders.MustParseVersion("1.2.4"),
|
||||
getproviders.MustParseVersionConstraints("= 1.2.4"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("vEthLkqAecdQimaW6JHZ0SBRNtHibLnOb31tX9ZXlcI="),
|
||||
getproviders.HashScheme1.New("b0v9t2QIGmmThEhnnOVHq7RU9d1j5v1iEWhmI5VFOpQ="),
|
||||
},
|
||||
),
|
||||
addrs.NewDefaultProvider("test"): depsfile.NewProviderLock(
|
||||
@ -1714,7 +1714,7 @@ func TestInit_providerSource(t *testing.T) {
|
||||
getproviders.MustParseVersion("1.2.3"),
|
||||
getproviders.MustParseVersionConstraints("= 1.2.3"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("8CjxaUBuegKZSFnRos39Fs+CS78ax0Dyb7aIA5XBiNI="),
|
||||
getproviders.HashScheme1.New("pE4OWJznTz5mLbgr4HYfs1oMKDOnCzmSwYP6syfGAfI="),
|
||||
},
|
||||
),
|
||||
addrs.NewDefaultProvider("source"): depsfile.NewProviderLock(
|
||||
@ -1722,7 +1722,7 @@ func TestInit_providerSource(t *testing.T) {
|
||||
getproviders.MustParseVersion("1.2.3"),
|
||||
getproviders.MustParseVersionConstraints("= 1.2.3"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("ACYytVQ2Q6JfoEs7xxCqa1yGFf9HwF3SEHzJKBoJfo0="),
|
||||
getproviders.HashScheme1.New("QFO4triI5Pc0nqKuAxT16LhBBmXSmPt3W4PrajMo9pw="),
|
||||
},
|
||||
),
|
||||
}
|
||||
@ -1731,10 +1731,10 @@ func TestInit_providerSource(t *testing.T) {
|
||||
t.Errorf("wrong version selections after upgrade\n%s", diff)
|
||||
}
|
||||
|
||||
if got, want := ui.OutputWriter.String(), "Installed hashicorp/test v1.2.3 (verified checksum)"; !strings.Contains(got, want) {
|
||||
if got, want := ui.OutputWriter.String(), "Installed opentofu/test v1.2.3 (verified checksum)"; !strings.Contains(got, want) {
|
||||
t.Fatalf("unexpected output: %s\nexpected to include %q", got, want)
|
||||
}
|
||||
if got, want := ui.ErrorWriter.String(), "\n - hashicorp/source\n - hashicorp/test\n - hashicorp/test-beta"; !strings.Contains(got, want) {
|
||||
if got, want := ui.ErrorWriter.String(), "\n - opentofu/source\n - opentofu/test\n - opentofu/test-beta"; !strings.Contains(got, want) {
|
||||
t.Fatalf("wrong error message\nshould contain: %s\ngot:\n%s", want, got)
|
||||
}
|
||||
}
|
||||
@ -1922,7 +1922,7 @@ func TestInit_getUpgradePlugins(t *testing.T) {
|
||||
getproviders.MustParseVersion("2.3.4"),
|
||||
getproviders.MustParseVersionConstraints("> 1.0.0, < 3.0.0"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("ntfa04OlRqIfGL/Gkd+nGMJSHGWyAgMQplFWk7WEsOk="),
|
||||
getproviders.HashScheme1.New("qcC2U/kpxLRmHf8QeXyxA/O4PhRqnxfRglPi+yhiSuw="),
|
||||
},
|
||||
),
|
||||
addrs.NewDefaultProvider("exact"): depsfile.NewProviderLock(
|
||||
@ -1930,7 +1930,7 @@ func TestInit_getUpgradePlugins(t *testing.T) {
|
||||
getproviders.MustParseVersion("1.2.3"),
|
||||
getproviders.MustParseVersionConstraints("= 1.2.3"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("Xgk+LFrzi9Mop6+d01TCTaD3kgSrUASCAUU1aDsEsJU="),
|
||||
getproviders.HashScheme1.New("H5ikHNkgwFdOMSJSscblbHiEb7y+w62o1c/SSf/evEc="),
|
||||
},
|
||||
),
|
||||
addrs.NewDefaultProvider("greater-than"): depsfile.NewProviderLock(
|
||||
@ -1938,7 +1938,7 @@ func TestInit_getUpgradePlugins(t *testing.T) {
|
||||
getproviders.MustParseVersion("2.3.4"),
|
||||
getproviders.MustParseVersionConstraints(">= 2.3.3"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("8M5DXICmUiVjbkxNNO0zXNsV6duCVNWzq3/Kf0mNIo4="),
|
||||
getproviders.HashScheme1.New("lfCCpvNgaAYcuXQmiDvxRXgn8zHl0p6gvcTm+9c3jKk="),
|
||||
},
|
||||
),
|
||||
}
|
||||
@ -2111,11 +2111,11 @@ func TestInit_providerLockFile(t *testing.T) {
|
||||
# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.2.3"
|
||||
constraints = "1.2.3"
|
||||
hashes = [
|
||||
"h1:8CjxaUBuegKZSFnRos39Fs+CS78ax0Dyb7aIA5XBiNI=",
|
||||
"h1:pE4OWJznTz5mLbgr4HYfs1oMKDOnCzmSwYP6syfGAfI=",
|
||||
]
|
||||
}
|
||||
`)
|
||||
@ -2138,11 +2138,11 @@ func TestInit_providerLockFileReadonly(t *testing.T) {
|
||||
# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.2.3"
|
||||
constraints = "1.2.3"
|
||||
hashes = [
|
||||
"zh:6f85a1f747dd09455cd77683c0e06da647d8240461b8b36b304b9056814d91f2",
|
||||
"zh:3a72690e72116f1551ef89b3638148ac7cb4c9ae54ea87402880ca42dea1451d",
|
||||
]
|
||||
}
|
||||
`)
|
||||
@ -2151,7 +2151,7 @@ provider "registry.opentofu.org/hashicorp/test" {
|
||||
# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.2.3"
|
||||
constraints = "1.2.3"
|
||||
hashes = [
|
||||
@ -2164,12 +2164,12 @@ provider "registry.opentofu.org/hashicorp/test" {
|
||||
# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.2.3"
|
||||
constraints = "1.2.3"
|
||||
hashes = [
|
||||
"h1:8CjxaUBuegKZSFnRos39Fs+CS78ax0Dyb7aIA5XBiNI=",
|
||||
"zh:6f85a1f747dd09455cd77683c0e06da647d8240461b8b36b304b9056814d91f2",
|
||||
"h1:pE4OWJznTz5mLbgr4HYfs1oMKDOnCzmSwYP6syfGAfI=",
|
||||
"zh:3a72690e72116f1551ef89b3638148ac7cb4c9ae54ea87402880ca42dea1451d",
|
||||
]
|
||||
}
|
||||
`)
|
||||
@ -2438,7 +2438,7 @@ func TestInit_pluginDirProviders(t *testing.T) {
|
||||
getproviders.MustParseVersion("2.3.4"),
|
||||
getproviders.MustParseVersionConstraints("> 1.0.0, < 3.0.0"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("ntfa04OlRqIfGL/Gkd+nGMJSHGWyAgMQplFWk7WEsOk="),
|
||||
getproviders.HashScheme1.New("qcC2U/kpxLRmHf8QeXyxA/O4PhRqnxfRglPi+yhiSuw="),
|
||||
},
|
||||
),
|
||||
addrs.NewDefaultProvider("exact"): depsfile.NewProviderLock(
|
||||
@ -2446,7 +2446,7 @@ func TestInit_pluginDirProviders(t *testing.T) {
|
||||
getproviders.MustParseVersion("1.2.3"),
|
||||
getproviders.MustParseVersionConstraints("= 1.2.3"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("Xgk+LFrzi9Mop6+d01TCTaD3kgSrUASCAUU1aDsEsJU="),
|
||||
getproviders.HashScheme1.New("H5ikHNkgwFdOMSJSscblbHiEb7y+w62o1c/SSf/evEc="),
|
||||
},
|
||||
),
|
||||
addrs.NewDefaultProvider("greater-than"): depsfile.NewProviderLock(
|
||||
@ -2454,7 +2454,7 @@ func TestInit_pluginDirProviders(t *testing.T) {
|
||||
getproviders.MustParseVersion("2.3.4"),
|
||||
getproviders.MustParseVersionConstraints(">= 2.3.3"),
|
||||
[]getproviders.Hash{
|
||||
getproviders.HashScheme1.New("8M5DXICmUiVjbkxNNO0zXNsV6duCVNWzq3/Kf0mNIo4="),
|
||||
getproviders.HashScheme1.New("lfCCpvNgaAYcuXQmiDvxRXgn8zHl0p6gvcTm+9c3jKk="),
|
||||
},
|
||||
),
|
||||
}
|
||||
@ -2531,13 +2531,13 @@ func TestInit_pluginDirProvidersDoesNotGet(t *testing.T) {
|
||||
// mention either the "exact" or "greater-than" provider, because the
|
||||
// latter two are available via the -plugin-dir directories.
|
||||
errStr := ui.ErrorWriter.String()
|
||||
if subStr := "hashicorp/between"; !strings.Contains(errStr, subStr) {
|
||||
if subStr := "opentofu/between"; !strings.Contains(errStr, subStr) {
|
||||
t.Errorf("error output should mention the 'between' provider\nwant substr: %s\ngot:\n%s", subStr, errStr)
|
||||
}
|
||||
if subStr := "hashicorp/exact"; strings.Contains(errStr, subStr) {
|
||||
if subStr := "opentofu/exact"; strings.Contains(errStr, subStr) {
|
||||
t.Errorf("error output should not mention the 'exact' provider\ndo not want substr: %s\ngot:\n%s", subStr, errStr)
|
||||
}
|
||||
if subStr := "hashicorp/greater-than"; strings.Contains(errStr, subStr) {
|
||||
if subStr := "opentofu/greater-than"; strings.Contains(errStr, subStr) {
|
||||
t.Errorf("error output should not mention the 'greater-than' provider\ndo not want substr: %s\ngot:\n%s", subStr, errStr)
|
||||
}
|
||||
|
||||
@ -2751,7 +2751,7 @@ func TestInit_tests(t *testing.T) {
|
||||
provider := applyFixtureProvider() // We just want the types from this provider.
|
||||
|
||||
providerSource, close := newMockProviderSource(t, map[string][]string{
|
||||
"hashicorp/test": {"1.0.0"},
|
||||
"opentofu/test": {"1.0.0"},
|
||||
})
|
||||
defer close()
|
||||
|
||||
@ -2781,7 +2781,7 @@ func TestInit_testsWithProvider(t *testing.T) {
|
||||
provider := applyFixtureProvider() // We just want the types from this provider.
|
||||
|
||||
providerSource, close := newMockProviderSource(t, map[string][]string{
|
||||
"hashicorp/test": {"1.0.0"},
|
||||
"opentofu/test": {"1.0.0"},
|
||||
})
|
||||
defer close()
|
||||
|
||||
@ -2805,9 +2805,8 @@ func TestInit_testsWithProvider(t *testing.T) {
|
||||
want := `
|
||||
Error: Failed to query available provider packages
|
||||
|
||||
Could not retrieve the list of available versions for provider
|
||||
hashicorp/test: no available releases match the given constraints 1.0.1,
|
||||
1.0.2
|
||||
Could not retrieve the list of available versions for provider opentofu/test:
|
||||
no available releases match the given constraints 1.0.1, 1.0.2
|
||||
|
||||
`
|
||||
if diff := cmp.Diff(got, want); len(diff) > 0 {
|
||||
@ -2824,7 +2823,7 @@ func TestInit_testsWithModule(t *testing.T) {
|
||||
provider := applyFixtureProvider() // We just want the types from this provider.
|
||||
|
||||
providerSource, close := newMockProviderSource(t, map[string][]string{
|
||||
"hashicorp/test": {"1.0.0"},
|
||||
"opentofu/test": {"1.0.0"},
|
||||
})
|
||||
defer close()
|
||||
|
||||
@ -2861,7 +2860,7 @@ func TestInit_testsWithModule(t *testing.T) {
|
||||
//
|
||||
// Provider addresses must be valid source strings, and passing only the
|
||||
// provider name will be interpreted as a "default" provider under
|
||||
// registry.opentofu.org/hashicorp. If you need more control over the
|
||||
// registry.opentofu.org/opentofu. If you need more control over the
|
||||
// provider addresses, pass a full provider source string.
|
||||
//
|
||||
// This function also registers providers as belonging to the current platform,
|
||||
@ -2980,13 +2979,13 @@ func expectedPackageInstallPath(name, version string, exe bool) string {
|
||||
platform := getproviders.CurrentPlatform
|
||||
baseDir := ".terraform/providers"
|
||||
if exe {
|
||||
p := fmt.Sprintf("registry.opentofu.org/hashicorp/%s/%s/%s/terraform-provider-%s_%s", name, version, platform, name, version)
|
||||
p := fmt.Sprintf("registry.opentofu.org/opentofu/%s/%s/%s/terraform-provider-%s_%s", name, version, platform, name, version)
|
||||
if platform.OS == "windows" {
|
||||
p += ".exe"
|
||||
}
|
||||
return filepath.ToSlash(filepath.Join(baseDir, p))
|
||||
}
|
||||
return filepath.ToSlash(filepath.Join(
|
||||
baseDir, fmt.Sprintf("registry.opentofu.org/hashicorp/%s/%s/%s", name, version, platform),
|
||||
baseDir, fmt.Sprintf("registry.opentofu.org/opentofu/%s/%s/%s", name, version, platform),
|
||||
))
|
||||
}
|
||||
|
@ -16,17 +16,17 @@ func TestFindSourceProviderConfig(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
StartKey: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ProviderMap: map[string]providerConfig{},
|
||||
Want: "",
|
||||
},
|
||||
{
|
||||
StartKey: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ProviderMap: map[string]providerConfig{
|
||||
"null": {
|
||||
Name: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ModuleAddress: "",
|
||||
},
|
||||
},
|
||||
@ -34,11 +34,11 @@ func TestFindSourceProviderConfig(t *testing.T) {
|
||||
},
|
||||
{
|
||||
StartKey: "null2",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ProviderMap: map[string]providerConfig{
|
||||
"null": {
|
||||
Name: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ModuleAddress: "",
|
||||
},
|
||||
},
|
||||
@ -46,11 +46,11 @@ func TestFindSourceProviderConfig(t *testing.T) {
|
||||
},
|
||||
{
|
||||
StartKey: "null",
|
||||
FullName: "hashicorp2/null",
|
||||
FullName: "opentofu2/null",
|
||||
ProviderMap: map[string]providerConfig{
|
||||
"null": {
|
||||
Name: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ModuleAddress: "",
|
||||
},
|
||||
},
|
||||
@ -58,16 +58,16 @@ func TestFindSourceProviderConfig(t *testing.T) {
|
||||
},
|
||||
{
|
||||
StartKey: "module.a:null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ProviderMap: map[string]providerConfig{
|
||||
"null": {
|
||||
Name: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ModuleAddress: "",
|
||||
},
|
||||
"module.a:null": {
|
||||
Name: "module.a:null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ModuleAddress: "module.a",
|
||||
parentKey: "null",
|
||||
},
|
||||
@ -76,16 +76,16 @@ func TestFindSourceProviderConfig(t *testing.T) {
|
||||
},
|
||||
{
|
||||
StartKey: "module.a:null",
|
||||
FullName: "hashicorp2/null",
|
||||
FullName: "opentofu2/null",
|
||||
ProviderMap: map[string]providerConfig{
|
||||
"null": {
|
||||
Name: "null",
|
||||
FullName: "hashicorp/null",
|
||||
FullName: "opentofu/null",
|
||||
ModuleAddress: "",
|
||||
},
|
||||
"module.a:null": {
|
||||
Name: "module.a:null",
|
||||
FullName: "hashicorp2/null",
|
||||
FullName: "opentofu2/null",
|
||||
ModuleAddress: "module.a",
|
||||
parentKey: "null",
|
||||
},
|
||||
|
@ -204,7 +204,7 @@ func TestMarshalPlanResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "example",
|
||||
Index: addrs.InstanceKey(nil),
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
SchemaVersion: 1,
|
||||
AttributeValues: AttributeValues{},
|
||||
SensitiveValues: json.RawMessage("{}"),
|
||||
@ -247,7 +247,7 @@ func TestMarshalPlanResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "example",
|
||||
Index: addrs.InstanceKey(nil),
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
SchemaVersion: 1,
|
||||
AttributeValues: AttributeValues{
|
||||
"woozles": json.RawMessage(`"baz"`),
|
||||
|
@ -225,7 +225,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`null`),
|
||||
"woozles": json.RawMessage(`"confuzles"`),
|
||||
@ -267,7 +267,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`"sensuzles"`),
|
||||
"woozles": json.RawMessage(`"confuzles"`),
|
||||
@ -313,7 +313,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`"confuzles"`),
|
||||
"woozles": json.RawMessage(`null`),
|
||||
@ -384,7 +384,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: json.RawMessage(`0`),
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`null`),
|
||||
"woozles": json.RawMessage(`"confuzles"`),
|
||||
@ -426,7 +426,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: json.RawMessage(`"rockhopper"`),
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`null`),
|
||||
"woozles": json.RawMessage(`"confuzles"`),
|
||||
@ -470,7 +470,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
DeposedKey: deposedKey.String(),
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`null`),
|
||||
@ -519,7 +519,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`null`),
|
||||
"woozles": json.RawMessage(`"confuzles"`),
|
||||
@ -532,7 +532,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_thing",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
DeposedKey: deposedKey.String(),
|
||||
AttributeValues: AttributeValues{
|
||||
"foozles": json.RawMessage(`null`),
|
||||
@ -579,7 +579,7 @@ func TestMarshalResources(t *testing.T) {
|
||||
Type: "test_map_attr",
|
||||
Name: "bar",
|
||||
Index: nil,
|
||||
ProviderName: "registry.opentofu.org/hashicorp/test",
|
||||
ProviderName: "registry.opentofu.org/opentofu/test",
|
||||
AttributeValues: AttributeValues{
|
||||
"data": json.RawMessage(`{"woozles":"confuzles"}`),
|
||||
},
|
||||
|
@ -1271,7 +1271,7 @@ func TestPlan_init_required(t *testing.T) {
|
||||
t.Fatalf("expected error, got success")
|
||||
}
|
||||
got := output.Stderr()
|
||||
if !(strings.Contains(got, "tofu init") && strings.Contains(got, "provider registry.opentofu.org/hashicorp/test: required by this configuration but no version is selected")) {
|
||||
if !(strings.Contains(got, "tofu init") && strings.Contains(got, "provider registry.opentofu.org/opentofu/test: required by this configuration but no version is selected")) {
|
||||
t.Fatal("wrong error message in output:", got)
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ func TestProvidersLock(t *testing.T) {
|
||||
expected := `# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.0.0"
|
||||
hashes = [
|
||||
"h1:7MjN4eFisdTv4tlhXH5hL4QQd39Jy4baPhFxwAd/EFE=",
|
||||
@ -60,7 +60,7 @@ provider "registry.opentofu.org/hashicorp/test" {
|
||||
expected := `# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.0.0"
|
||||
hashes = [
|
||||
"h1:7MjN4eFisdTv4tlhXH5hL4QQd39Jy4baPhFxwAd/EFE=",
|
||||
@ -80,8 +80,8 @@ func runProviderLockGenericTest(t *testing.T, testDirectory, expected string) {
|
||||
// Our fixture dir has a generic os_arch dir, which we need to customize
|
||||
// to the actual OS/arch where this test is running in order to get the
|
||||
// desired result.
|
||||
fixtMachineDir := filepath.Join(td, "fs-mirror/registry.opentofu.org/hashicorp/test/1.0.0/os_arch")
|
||||
wantMachineDir := filepath.Join(td, "fs-mirror/registry.opentofu.org/hashicorp/test/1.0.0/", fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||
fixtMachineDir := filepath.Join(td, "fs-mirror/registry.opentofu.org/opentofu/test/1.0.0/os_arch")
|
||||
wantMachineDir := filepath.Join(td, "fs-mirror/registry.opentofu.org/opentofu/test/1.0.0/", fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH))
|
||||
err := os.Rename(fixtMachineDir, wantMachineDir)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
@ -168,14 +168,14 @@ func TestProvidersLock_args(t *testing.T) {
|
||||
}
|
||||
|
||||
// There is no configuration, so it's not valid to use any provider argument
|
||||
args := []string{"hashicorp/random"}
|
||||
args := []string{"opentofu/random"}
|
||||
code := c.Run(args)
|
||||
|
||||
if code != 1 {
|
||||
t.Fatalf("wrong exit code; expected 1, got %d", code)
|
||||
}
|
||||
output := ui.ErrorWriter.String()
|
||||
if !strings.Contains(output, "The provider registry.opentofu.org/hashicorp/random is not required by the\ncurrent configuration.") {
|
||||
if !strings.Contains(output, "The provider registry.opentofu.org/opentofu/random is not required by the\ncurrent configuration.") {
|
||||
t.Fatalf("missing expected error message: %s", output)
|
||||
}
|
||||
})
|
||||
|
@ -34,9 +34,9 @@ func TestProviders(t *testing.T) {
|
||||
}
|
||||
|
||||
wantOutput := []string{
|
||||
"provider[registry.opentofu.org/hashicorp/foo]",
|
||||
"provider[registry.opentofu.org/hashicorp/bar]",
|
||||
"provider[registry.opentofu.org/hashicorp/baz]",
|
||||
"provider[registry.opentofu.org/opentofu/foo]",
|
||||
"provider[registry.opentofu.org/opentofu/bar]",
|
||||
"provider[registry.opentofu.org/opentofu/baz]",
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
@ -116,10 +116,10 @@ func TestProviders_modules(t *testing.T) {
|
||||
}
|
||||
|
||||
wantOutput := []string{
|
||||
"provider[registry.opentofu.org/hashicorp/foo] 1.0.0", // from required_providers
|
||||
"provider[registry.opentofu.org/hashicorp/bar] 2.0.0", // from provider config
|
||||
"── module.kiddo", // tree node for child module
|
||||
"provider[registry.opentofu.org/hashicorp/baz]", // implied by a resource in the child module
|
||||
"provider[registry.opentofu.org/opentofu/foo] 1.0.0", // from required_providers
|
||||
"provider[registry.opentofu.org/opentofu/bar] 2.0.0", // from provider config
|
||||
"── module.kiddo", // tree node for child module
|
||||
"provider[registry.opentofu.org/opentofu/baz]", // implied by a resource in the child module
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
@ -153,10 +153,10 @@ func TestProviders_state(t *testing.T) {
|
||||
}
|
||||
|
||||
wantOutput := []string{
|
||||
"provider[registry.opentofu.org/hashicorp/foo] 1.0.0", // from required_providers
|
||||
"provider[registry.opentofu.org/hashicorp/bar] 2.0.0", // from a provider config block
|
||||
"Providers required by state", // header for state providers
|
||||
"provider[registry.opentofu.org/hashicorp/baz]", // from a resouce in state (only)
|
||||
"provider[registry.opentofu.org/opentofu/foo] 1.0.0", // from required_providers
|
||||
"provider[registry.opentofu.org/opentofu/bar] 2.0.0", // from a provider config block
|
||||
"Providers required by state", // header for state providers
|
||||
"provider[registry.opentofu.org/opentofu/baz]", // from a resouce in state (only)
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
@ -190,9 +190,9 @@ func TestProviders_tests(t *testing.T) {
|
||||
}
|
||||
|
||||
wantOutput := []string{
|
||||
"provider[registry.opentofu.org/hashicorp/foo]",
|
||||
"provider[registry.opentofu.org/opentofu/foo]",
|
||||
"test.main",
|
||||
"provider[registry.opentofu.org/hashicorp/bar]",
|
||||
"provider[registry.opentofu.org/opentofu/bar]",
|
||||
}
|
||||
|
||||
output := ui.OutputWriter.String()
|
||||
|
@ -968,10 +968,10 @@ foo = "bar"
|
||||
const testRefreshStr = `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
const testRefreshCwdStr = `
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
@ -546,8 +546,8 @@ func TestShow_json_output(t *testing.T) {
|
||||
expectError := strings.Contains(entry.Name(), "error")
|
||||
|
||||
providerSource, close := newMockProviderSource(t, map[string][]string{
|
||||
"test": {"1.2.3"},
|
||||
"hashicorp2/test": {"1.2.3"},
|
||||
"test": {"1.2.3"},
|
||||
"opentofu2/test": {"1.2.3"},
|
||||
})
|
||||
defer close()
|
||||
|
||||
|
@ -473,12 +473,12 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||
testStateOutput(t, statePath, `
|
||||
test_instance.bar.0:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.baz:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -691,12 +691,12 @@ func TestStateMv_instanceToResource(t *testing.T) {
|
||||
testStateOutput(t, statePath, `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.baz:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -709,12 +709,12 @@ test_instance.baz:
|
||||
testStateOutput(t, backups[0], `
|
||||
test_instance.baz:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.0:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -766,7 +766,7 @@ func TestStateMv_instanceToNewResource(t *testing.T) {
|
||||
testStateOutput(t, statePath, `
|
||||
test_instance.bar["new"]:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -787,7 +787,7 @@ test_instance.bar["new"]:
|
||||
module.test:
|
||||
test_instance.baz["new"]:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -1787,7 +1787,7 @@ func TestStateMv_checkRequiredVersion(t *testing.T) {
|
||||
const testStateMvOutputOriginal = `
|
||||
test_instance.baz:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
|
||||
@ -1795,7 +1795,7 @@ test_instance.baz:
|
||||
test_instance.foo
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1803,12 +1803,12 @@ test_instance.foo:
|
||||
const testStateMvOutput = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.baz:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1816,7 +1816,7 @@ test_instance.baz:
|
||||
const testStateMvBackupAndBackupOutOptionsWithNonLocalBackendOutput = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1824,12 +1824,12 @@ test_instance.bar:
|
||||
const testStateMvCount_stateOut = `
|
||||
test_instance.bar.0:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.1:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1837,7 +1837,7 @@ test_instance.bar.1:
|
||||
const testStateMvCount_stateOutSrc = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1845,17 +1845,17 @@ test_instance.bar:
|
||||
const testStateMvCount_stateOutOriginal = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.0:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.1:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1863,57 +1863,57 @@ test_instance.foo.1:
|
||||
const testStateMvLargeCount_stateOut = `
|
||||
test_instance.bar.0:
|
||||
ID = foo0
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.1:
|
||||
ID = foo1
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.2:
|
||||
ID = foo2
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.3:
|
||||
ID = foo3
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.4:
|
||||
ID = foo4
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.5:
|
||||
ID = foo5
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.6:
|
||||
ID = foo6
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.7:
|
||||
ID = foo7
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.8:
|
||||
ID = foo8
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.9:
|
||||
ID = foo9
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.bar.10:
|
||||
ID = foo10
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1921,7 +1921,7 @@ test_instance.bar.10:
|
||||
const testStateMvLargeCount_stateOutSrc = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1929,62 +1929,62 @@ test_instance.bar:
|
||||
const testStateMvLargeCount_stateOutOriginal = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.0:
|
||||
ID = foo0
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.1:
|
||||
ID = foo1
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.2:
|
||||
ID = foo2
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.3:
|
||||
ID = foo3
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.4:
|
||||
ID = foo4
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.5:
|
||||
ID = foo5
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.6:
|
||||
ID = foo6
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.7:
|
||||
ID = foo7
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.8:
|
||||
ID = foo8
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.9:
|
||||
ID = foo9
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo.10:
|
||||
ID = foo10
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -1994,13 +1994,13 @@ const testStateMvNestedModule_stateOut = `
|
||||
module.bar.child1:
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
module.bar.child2:
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2010,7 +2010,7 @@ const testStateMvNewModule_stateOut = `
|
||||
module.bar:
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2020,7 +2020,7 @@ const testStateMvModuleNewModule_stateOut = `
|
||||
module.foo:
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2028,7 +2028,7 @@ module.foo:
|
||||
const testStateMvNewModule_stateOutOriginal = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2042,13 +2042,13 @@ const testStateMvNestedModule_stateOutOriginal = `
|
||||
module.foo.child1:
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
module.foo.child2:
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2056,7 +2056,7 @@ module.foo.child2:
|
||||
const testStateMvOutput_stateOut = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2068,7 +2068,7 @@ const testStateMvOutput_stateOutSrc = `
|
||||
const testStateMvOutput_stateOutOriginal = `
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2080,18 +2080,18 @@ const testStateMvExisting_stateSrc = `
|
||||
const testStateMvExisting_stateDst = `
|
||||
test_instance.bar:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.qux:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
||||
const testStateMvExisting_stateSrcOriginal = `
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2099,13 +2099,13 @@ test_instance.foo:
|
||||
const testStateMvExisting_stateDstOriginal = `
|
||||
test_instance.qux:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
||||
const testStateMvOriginal_backend = `
|
||||
test_instance.baz:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2115,7 +2115,7 @@ const testStateMvOnlyResourceInModule_original = `
|
||||
module.foo:
|
||||
test_instance.foo.0:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -2125,7 +2125,7 @@ const testStateMvOnlyResourceInModule_output = `
|
||||
module.foo:
|
||||
test_instance.bar.0:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
|
@ -84,7 +84,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
"-state", statePath,
|
||||
"hashicorp/aws",
|
||||
"opentofu/aws",
|
||||
"acmecorp/aws",
|
||||
}
|
||||
if code := c.Run(args); code != 0 {
|
||||
@ -120,7 +120,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
args := []string{
|
||||
"-state", statePath,
|
||||
"-auto-approve",
|
||||
"hashicorp/aws",
|
||||
"opentofu/aws",
|
||||
"acmecorp/aws",
|
||||
}
|
||||
if code := c.Run(args); code != 0 {
|
||||
@ -156,7 +156,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
"-state", statePath,
|
||||
"hashicorp/aws",
|
||||
"opentofu/aws",
|
||||
"acmecorp/aws",
|
||||
}
|
||||
if code := c.Run(args); code != 0 {
|
||||
@ -187,7 +187,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
"-state", statePath,
|
||||
"hashicorp/google",
|
||||
"opentofu/google",
|
||||
"acmecorp/google",
|
||||
}
|
||||
if code := c.Run(args); code != 0 {
|
||||
@ -216,7 +216,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
"-invalid",
|
||||
"hashicorp/google",
|
||||
"opentofu/google",
|
||||
"acmecorp/google",
|
||||
}
|
||||
if code := c.Run(args); code == 0 {
|
||||
@ -263,7 +263,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"hashicorp/google_cloud",
|
||||
"opentofu/google_cloud",
|
||||
"-/-/google",
|
||||
}
|
||||
if code := c.Run(args); code == 0 {
|
||||
@ -272,7 +272,7 @@ func TestStateReplaceProvider(t *testing.T) {
|
||||
|
||||
got := ui.ErrorWriter.String()
|
||||
msgs := []string{
|
||||
`Invalid "from" provider "hashicorp/google_cloud"`,
|
||||
`Invalid "from" provider "opentofu/google_cloud"`,
|
||||
"Invalid provider type",
|
||||
`Invalid "to" provider "-/-/google"`,
|
||||
"Invalid provider source hostname",
|
||||
@ -370,7 +370,7 @@ func TestStateReplaceProvider_checkRequiredVersion(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
"-state", statePath,
|
||||
"hashicorp/aws",
|
||||
"opentofu/aws",
|
||||
"acmecorp/aws",
|
||||
}
|
||||
if code := c.Run(args); code != 1 {
|
||||
@ -393,12 +393,12 @@ func TestStateReplaceProvider_checkRequiredVersion(t *testing.T) {
|
||||
const testStateReplaceProviderOutputOriginal = `
|
||||
aws_instance.alpha:
|
||||
ID = alpha
|
||||
provider = provider["registry.opentofu.org/hashicorp/aws"]
|
||||
provider = provider["registry.opentofu.org/opentofu/aws"]
|
||||
bar = value
|
||||
foo = value
|
||||
aws_instance.beta:
|
||||
ID = beta
|
||||
provider = provider["registry.opentofu.org/hashicorp/aws"]
|
||||
provider = provider["registry.opentofu.org/opentofu/aws"]
|
||||
bar = value
|
||||
foo = value
|
||||
azurerm_virtual_machine.gamma:
|
||||
|
@ -147,7 +147,7 @@ func TestStateRmNotChildModule(t *testing.T) {
|
||||
module.child:
|
||||
test_instance.foo:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -160,14 +160,14 @@ module.child:
|
||||
testStateOutput(t, backups[0], `
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
|
||||
module.child:
|
||||
test_instance.foo:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`)
|
||||
@ -563,12 +563,12 @@ func TestStateRm_checkRequiredVersion(t *testing.T) {
|
||||
const testStateRmOutputOriginal = `
|
||||
test_instance.bar:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
@ -576,7 +576,7 @@ test_instance.foo:
|
||||
const testStateRmOutput = `
|
||||
test_instance.bar:
|
||||
ID = foo
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
bar = value
|
||||
foo = value
|
||||
`
|
||||
|
@ -546,22 +546,22 @@ func TestTaint_checkRequiredVersion(t *testing.T) {
|
||||
const testTaintStr = `
|
||||
test_instance.foo: (tainted)
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
||||
const testTaintDefaultStr = `
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
||||
const testTaintModuleStr = `
|
||||
test_instance.foo:
|
||||
ID = bar
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
|
||||
module.child:
|
||||
test_instance.blah: (tainted)
|
||||
ID = blah
|
||||
provider = provider["registry.opentofu.org/hashicorp/test"]
|
||||
provider = provider["registry.opentofu.org/opentofu/test"]
|
||||
`
|
||||
|
@ -673,9 +673,9 @@ Failure! 0 passed, 1 failed.
|
||||
Error: Provider configuration not present
|
||||
|
||||
To work with test_resource.secondary its original provider configuration at
|
||||
provider["registry.opentofu.org/hashicorp/test"].secondary is required, but
|
||||
it has been removed. This occurs when a provider configuration is removed
|
||||
while objects created by that provider still exist in the state. Re-add the
|
||||
provider["registry.opentofu.org/opentofu/test"].secondary is required, but it
|
||||
has been removed. This occurs when a provider configuration is removed while
|
||||
objects created by that provider still exist in the state. Re-add the
|
||||
provider configuration to destroy test_resource.secondary, after which you
|
||||
can remove the provider configuration again.
|
||||
`,
|
||||
@ -690,9 +690,9 @@ Failure! 0 passed, 1 failed.
|
||||
Error: Provider configuration not present
|
||||
|
||||
To work with test_resource.secondary its original provider configuration at
|
||||
provider["registry.opentofu.org/hashicorp/test"].secondary is required, but
|
||||
it has been removed. This occurs when a provider configuration is removed
|
||||
while objects created by that provider still exist in the state. Re-add the
|
||||
provider["registry.opentofu.org/opentofu/test"].secondary is required, but it
|
||||
has been removed. This occurs when a provider configuration is removed while
|
||||
objects created by that provider still exist in the state. Re-add the
|
||||
provider configuration to destroy test_resource.secondary, after which you
|
||||
can remove the provider configuration again.
|
||||
`,
|
||||
@ -708,9 +708,9 @@ Failure! 1 passed, 1 failed.
|
||||
Error: Provider configuration not present
|
||||
|
||||
To work with test_resource.secondary its original provider configuration at
|
||||
provider["registry.opentofu.org/hashicorp/test"].secondary is required, but
|
||||
it has been removed. This occurs when a provider configuration is removed
|
||||
while objects created by that provider still exist in the state. Re-add the
|
||||
provider["registry.opentofu.org/opentofu/test"].secondary is required, but it
|
||||
has been removed. This occurs when a provider configuration is removed while
|
||||
objects created by that provider still exist in the state. Re-add the
|
||||
provider configuration to destroy test_resource.secondary, after which you
|
||||
can remove the provider configuration again.
|
||||
`,
|
||||
|
@ -1,3 +1,3 @@
|
||||
// This will try to install hashicorp/baz, fail, and then suggest
|
||||
// This will try to install opentofu/baz, fail, and then suggest
|
||||
// terraform-providers/baz
|
||||
provider baz {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// This should result in installing hashicorp/foo
|
||||
// This should result in installing opentofu/foo
|
||||
provider foo {}
|
||||
|
||||
// This will try to install hashicorp/baz, fail, and then suggest
|
||||
// This will try to install opentofu/baz, fail, and then suggest
|
||||
// terraform-providers/baz
|
||||
provider baz {}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Intentionally blank, but intended to be used in a test case which
|
||||
# uses an input lock file which already had an entry for the hashicorp/test
|
||||
# uses an input lock file which already had an entry for the opentofu/test
|
||||
# provider, and should therefore detect it as no longer used.
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
test = {
|
||||
source = "hashicorp/test"
|
||||
source = "opentofu/test"
|
||||
version = "1.0.2"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
test = {
|
||||
source = "hashicorp/test"
|
||||
source = "opentofu/test"
|
||||
version = "1.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"provider": "provider[\"registry.opentofu.org/hashicorp/test\"]",
|
||||
"provider": "provider[\"registry.opentofu.org/opentofu/test\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
|
@ -10,7 +10,7 @@
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"provider": "provider[\"registry.opentofu.org/hashicorp/test\"]",
|
||||
"provider": "provider[\"registry.opentofu.org/opentofu/test\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/hashicorp/test" {
|
||||
provider "registry.opentofu.org/opentofu/test" {
|
||||
version = "1.0.0"
|
||||
hashes = [
|
||||
"h1:invalid",
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
test = {
|
||||
source = "hashicorp/test"
|
||||
source = "opentofu/test"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
test = {
|
||||
source = "hashicorp/test"
|
||||
source = "opentofu/test"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": "1.0",
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/test": {
|
||||
"registry.opentofu.org/opentofu/test": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": "1.0",
|
||||
"provider_schemas": {
|
||||
"registry.opentofu.org/hashicorp/test": {
|
||||
"registry.opentofu.org/opentofu/test": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
|
@ -1,7 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
test = {
|
||||
source = "hashicorp/test"
|
||||
source = "opentofu/test"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
"mode": "managed",
|
||||
"type": "baz_instance",
|
||||
"name": "example",
|
||||
"provider": "provider[\"registry.opentofu.org/hashicorp/baz\"]",
|
||||
"provider": "provider[\"registry.opentofu.org/opentofu/baz\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
|
@ -21,7 +21,7 @@
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "bar",
|
||||
@ -37,7 +37,7 @@
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "bar",
|
||||
@ -53,7 +53,7 @@
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "bar",
|
||||
@ -85,7 +85,7 @@
|
||||
"index": 0,
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"name": "test",
|
||||
"change": {
|
||||
"actions": [
|
||||
@ -108,7 +108,7 @@
|
||||
"index": 1,
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"name": "test",
|
||||
"change": {
|
||||
"actions": [
|
||||
@ -131,7 +131,7 @@
|
||||
"index": 2,
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"name": "test",
|
||||
"change": {
|
||||
"actions": [
|
||||
@ -166,7 +166,7 @@
|
||||
"provider_config": {
|
||||
"test": {
|
||||
"name": "test",
|
||||
"full_name": "registry.opentofu.org/hashicorp/test",
|
||||
"full_name": "registry.opentofu.org/opentofu/test",
|
||||
"expressions": {
|
||||
"region": {
|
||||
"constant_value": "somewhere"
|
||||
|
@ -10,7 +10,7 @@
|
||||
"type": "test_instance",
|
||||
"name": "example",
|
||||
"index": 0,
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": null,
|
||||
@ -24,7 +24,7 @@
|
||||
"type": "test_instance",
|
||||
"name": "example",
|
||||
"index": 1,
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": null,
|
||||
|
@ -10,7 +10,7 @@
|
||||
"type": "test_instance",
|
||||
"name": "example",
|
||||
"each": "list",
|
||||
"provider": "provider[\"registry.opentofu.org/hashicorp/test\"]",
|
||||
"provider": "provider[\"registry.opentofu.org/opentofu/test\"]",
|
||||
"instances": [
|
||||
{
|
||||
"index_key": 0,
|
||||
|
@ -18,7 +18,7 @@
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "example",
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "bar-var",
|
||||
@ -37,7 +37,7 @@
|
||||
"type": "test_instance",
|
||||
"name": "example",
|
||||
"index": 0,
|
||||
"provider_name": "registry.opentofu.org/hashicorp/test",
|
||||
"provider_name": "registry.opentofu.org/opentofu/test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "foo-var",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user