replace provider and provisioner types in tests

The field assignments and methods are incorrect still, but the type
definitions and returns are now updated.
This commit is contained in:
James Bardin 2018-08-17 15:32:35 -04:00 committed by Martin Atkins
parent 549544f201
commit 0b76c42ad2
18 changed files with 955 additions and 919 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,8 @@ import (
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/provisioners"
)
// simpleMockComponentFactory returns a component factory pre-configured with
@ -24,13 +26,13 @@ func simpleMockComponentFactory() *basicComponentFactory {
provider := simpleMockProvider()
provisioner := simpleMockProvisioner()
return &basicComponentFactory{
providers: map[string]ResourceProviderFactory{
"test": func() (ResourceProvider, error) {
providers: map[string]providers.Factory{
"test": func() (providers.Interface, error) {
return provider, nil
},
},
provisioners: map[string]ResourceProvisionerFactory{
"test": func() (ResourceProvisioner, error) {
provisioners: map[string]ProvisionerFactory{
"test": func() (provisioners.Interface, error) {
return provisioner, nil
},
},

View File

@ -3,8 +3,9 @@ package terraform
import (
"testing"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/zclconf/go-cty/cty"
)
@ -13,8 +14,8 @@ import (
// situations used as the basis for multiple tests.
type contextTestFixture struct {
Config *configs.Config
ProviderResolver ResourceProviderResolver
Provisioners map[string]ResourceProvisionerFactory
ProviderResolver providers.Resolver
Provisioners map[string]ProvisionerFactory
}
// ContextOpts returns a ContextOps pre-populated with the elements of this
@ -49,8 +50,8 @@ func contextFixtureApplyVars(t *testing.T) *contextTestFixture {
p.DiffFn = testDiffFn
return &contextTestFixture{
Config: c,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -75,8 +76,8 @@ func contextFixtureApplyVarsEnv(t *testing.T) *contextTestFixture {
p.DiffFn = testDiffFn
return &contextTestFixture{
Config: c,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),

View File

@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/states"
"github.com/zclconf/go-cty/cty"
)
@ -16,8 +17,8 @@ func TestContextImport_basic(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -56,8 +57,8 @@ func TestContextImport_countIndex(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -97,8 +98,8 @@ func TestContextImport_collision(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -155,8 +156,8 @@ func TestContextImport_missingType(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -225,8 +226,8 @@ func TestContextImport_moduleProvider(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -265,8 +266,8 @@ func TestContextImport_providerModule(t *testing.T) {
m := testModule(t, "import-provider-module")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -318,8 +319,8 @@ func TestContextImport_providerVarConfig(t *testing.T) {
m := testModule(t, "import-provider-vars")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -381,8 +382,8 @@ func TestContextImport_providerNonVarConfig(t *testing.T) {
m := testModule(t, "import-provider-non-vars")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -416,8 +417,8 @@ func TestContextImport_refresh(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -464,8 +465,8 @@ func TestContextImport_refreshNil(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -509,8 +510,8 @@ func TestContextImport_module(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -550,8 +551,8 @@ func TestContextImport_moduleDepth2(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -591,8 +592,8 @@ func TestContextImport_moduleDiff(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -649,8 +650,8 @@ func TestContextImport_moduleExisting(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -707,8 +708,8 @@ func TestContextImport_multiState(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -752,8 +753,8 @@ func TestContextImport_multiStateSame(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -802,8 +803,8 @@ func TestContextImport_customProviderMissing(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -837,8 +838,8 @@ func TestContextImport_customProvider(t *testing.T) {
m := testModule(t, "import-provider-alias")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),

View File

@ -8,6 +8,7 @@ import (
"testing"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/states"
@ -24,8 +25,8 @@ func TestContext2Input(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -71,8 +72,8 @@ func TestContext2Input_moduleComputedOutputElement(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -94,8 +95,8 @@ func TestContext2Input_badVarDefault(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -139,8 +140,8 @@ func TestContext2Input_provider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -210,8 +211,8 @@ func TestContext2Input_providerMulti(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -255,8 +256,8 @@ func TestContext2Input_providerOnce(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -311,8 +312,8 @@ func TestContext2Input_providerId(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -377,8 +378,8 @@ func TestContext2Input_providerOnly(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -433,8 +434,8 @@ func TestContext2Input_providerVars(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -486,8 +487,8 @@ func TestContext2Input_providerVarsModuleInherit(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -517,8 +518,8 @@ func TestContext2Input_varOnly(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -577,8 +578,8 @@ func TestContext2Input_varOnlyUnset(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -624,8 +625,8 @@ func TestContext2Input_varWithDefault(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -673,8 +674,8 @@ func TestContext2Input_varPartiallyComputed(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -739,8 +740,8 @@ func TestContext2Input_interpolateVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"template": testProviderFuncFixed(p),
},
),
@ -770,8 +771,8 @@ func TestContext2Input_hcl(t *testing.T) {
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"hcl": testProviderFuncFixed(p),
},
),
@ -814,8 +815,8 @@ func TestContext2Input_submoduleTriggersInvalidCount(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -874,8 +875,8 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),

View File

@ -16,6 +16,7 @@ import (
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
)
func TestContext2Plan_basic(t *testing.T) {
@ -24,8 +25,8 @@ func TestContext2Plan_basic(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -80,8 +81,8 @@ func TestContext2Plan_createBefore_deposed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -116,8 +117,8 @@ func TestContext2Plan_createBefore_maintainRoot(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -164,8 +165,8 @@ func TestContext2Plan_emptyDiff(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -189,8 +190,8 @@ func TestContext2Plan_escapedVar(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -214,8 +215,8 @@ func TestContext2Plan_minimal(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -239,8 +240,8 @@ func TestContext2Plan_modules(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -276,8 +277,8 @@ func TestContext2Plan_moduleCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -303,8 +304,8 @@ func TestContext2Plan_moduleDeadlock(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -340,8 +341,8 @@ func TestContext2Plan_moduleInput(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -365,8 +366,8 @@ func TestContext2Plan_moduleInputComputed(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -390,8 +391,8 @@ func TestContext2Plan_moduleInputFromVar(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -433,8 +434,8 @@ func TestContext2Plan_moduleMultiVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -473,8 +474,8 @@ func TestContext2Plan_moduleOrphans(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -538,12 +539,12 @@ func TestContext2Plan_moduleOrphansWithProvisioner(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
Provisioners: map[string]ResourceProvisionerFactory{
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
State: s,
@ -587,9 +588,9 @@ func TestContext2Plan_moduleProviderInherit(t *testing.T) {
m := testModule(t, "plan-module-provider-inherit")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"aws": func() (ResourceProvider, error) {
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": func() (providers.Interface, error) {
l.Lock()
defer l.Unlock()
@ -653,9 +654,9 @@ func TestContext2Plan_moduleProviderInheritDeep(t *testing.T) {
m := testModule(t, "plan-module-provider-inherit-deep")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"aws": func() (ResourceProvider, error) {
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": func() (providers.Interface, error) {
l.Lock()
defer l.Unlock()
@ -714,9 +715,9 @@ func TestContext2Plan_moduleProviderDefaultsVar(t *testing.T) {
m := testModule(t, "plan-module-provider-defaults-var")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"aws": func() (ResourceProvider, error) {
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": func() (providers.Interface, error) {
l.Lock()
defer l.Unlock()
@ -799,8 +800,8 @@ func TestContext2Plan_moduleProviderVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -824,8 +825,8 @@ func TestContext2Plan_moduleVar(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -849,8 +850,8 @@ func TestContext2Plan_moduleVarWrongTypeBasic(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -868,8 +869,8 @@ func TestContext2Plan_moduleVarWrongTypeNested(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),
@ -887,8 +888,8 @@ func TestContext2Plan_moduleVarWithDefaultValue(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),
@ -906,8 +907,8 @@ func TestContext2Plan_moduleVarComputed(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -941,8 +942,8 @@ func TestContext2Plan_nil(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -979,8 +980,8 @@ func TestContext2Plan_preventDestroy_bad(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1018,8 +1019,8 @@ func TestContext2Plan_preventDestroy_good(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1056,8 +1057,8 @@ func TestContext2Plan_preventDestroy_countBad(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1111,8 +1112,8 @@ func TestContext2Plan_preventDestroy_countGood(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1165,8 +1166,8 @@ func TestContext2Plan_preventDestroy_countGoodNoChange(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1207,8 +1208,8 @@ func TestContext2Plan_preventDestroy_destroyPlan(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1248,12 +1249,12 @@ func TestContext2Plan_provisionerCycle(t *testing.T) {
pr := testProvisioner()
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
Provisioners: map[string]ResourceProvisionerFactory{
Provisioners: map[string]ProvisionerFactory{
"local-exec": testProvisionerFuncFixed(pr),
},
})
@ -1270,8 +1271,8 @@ func TestContext2Plan_computed(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1314,8 +1315,8 @@ func TestContext2Plan_computedDataResource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1378,8 +1379,8 @@ func TestContext2Plan_computedDataCountResource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1410,8 +1411,8 @@ func TestContext2Plan_localValueCount(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"test": testProviderFuncFixed(p),
},
),
@ -1503,8 +1504,8 @@ func TestContext2Plan_dataSourceTypeMismatch(t *testing.T) {
},
},
}),
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1572,8 +1573,8 @@ func TestContext2Plan_dataResourceBecomesComputed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1658,8 +1659,8 @@ func TestContext2Plan_computedList(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1685,8 +1686,8 @@ func TestContext2Plan_computedMultiIndex(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1710,8 +1711,8 @@ func TestContext2Plan_count(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1739,8 +1740,8 @@ func TestContext2Plan_countComputed(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1758,8 +1759,8 @@ func TestContext2Plan_countComputedModule(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1780,8 +1781,8 @@ func TestContext2Plan_countModuleStatic(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1816,8 +1817,8 @@ func TestContext2Plan_countModuleStaticGrandchild(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1852,8 +1853,8 @@ func TestContext2Plan_countIndex(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1877,8 +1878,8 @@ func TestContext2Plan_countVar(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1918,8 +1919,8 @@ func TestContext2Plan_countZero(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1944,8 +1945,8 @@ func TestContext2Plan_countOneIndex(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2000,8 +2001,8 @@ func TestContext2Plan_countDecreaseToOne(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2045,8 +2046,8 @@ func TestContext2Plan_countIncreaseFromNotSet(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2090,8 +2091,8 @@ func TestContext2Plan_countIncreaseFromOne(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2150,8 +2151,8 @@ func TestContext2Plan_countIncreaseFromOneCorrupted(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2240,8 +2241,8 @@ func TestContext2Plan_countIncreaseWithSplatReference(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2311,8 +2312,8 @@ func TestContext2Plan_destroy(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2368,8 +2369,8 @@ func TestContext2Plan_moduleDestroy(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2422,8 +2423,8 @@ func TestContext2Plan_moduleDestroyCycle(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2474,8 +2475,8 @@ func TestContext2Plan_moduleDestroyMultivar(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2518,8 +2519,8 @@ func TestContext2Plan_pathVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2570,8 +2571,8 @@ func TestContext2Plan_diffVar(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2616,8 +2617,8 @@ func TestContext2Plan_hook(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
Hooks: []Hook{h},
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2645,8 +2646,8 @@ func TestContext2Plan_closeProvider(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2683,8 +2684,8 @@ func TestContext2Plan_orphan(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2711,8 +2712,8 @@ func TestContext2Plan_shadowUuid(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2745,8 +2746,8 @@ func TestContext2Plan_state(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2798,8 +2799,8 @@ func TestContext2Plan_taint(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2855,8 +2856,8 @@ func TestContext2Plan_taintIgnoreChanges(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2906,8 +2907,8 @@ func TestContext2Plan_taintDestroyInterpolatedCountRace(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2948,8 +2949,8 @@ func TestContext2Plan_targeted(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -2990,8 +2991,8 @@ func TestContext2Plan_targetedCrossModule(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3046,8 +3047,8 @@ func TestContext2Plan_targetedModuleWithProvider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),
@ -3083,8 +3084,8 @@ func TestContext2Plan_targetedOrphan(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3146,8 +3147,8 @@ func TestContext2Plan_targetedModuleOrphan(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3210,8 +3211,8 @@ func TestContext2Plan_targetedModuleUntargetedVariable(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3256,8 +3257,8 @@ func TestContext2Plan_outputContainsTargetedResource(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3294,8 +3295,8 @@ func TestContext2Plan_targetedOverTen(t *testing.T) {
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3373,8 +3374,8 @@ func TestContext2Plan_provider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3400,8 +3401,8 @@ func TestContext2Plan_varListErr(t *testing.T) {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3446,8 +3447,8 @@ func TestContext2Plan_ignoreChanges(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3512,8 +3513,8 @@ func TestContext2Plan_ignoreChangesWildcard(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3585,8 +3586,8 @@ func TestContext2Plan_moduleMapLiteral(t *testing.T) {
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3632,8 +3633,8 @@ func TestContext2Plan_computedValueInMap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3675,8 +3676,8 @@ func TestContext2Plan_moduleVariableFromSplat(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3727,8 +3728,8 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3782,8 +3783,8 @@ func TestContext2Plan_listOrder(t *testing.T) {
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3861,8 +3862,8 @@ func TestContext2Plan_ignoreChangesWithFlatmaps(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -3968,8 +3969,8 @@ func TestContext2Plan_resourceNestedCount(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -4088,8 +4089,8 @@ func TestContext2Plan_computedAttrRefTypeMismatch(t *testing.T) {
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -4121,8 +4122,8 @@ func TestContext2Plan_selfRef(t *testing.T) {
m := testModule(t, "plan-self-ref")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -4160,8 +4161,8 @@ func TestContext2Plan_selfRefMulti(t *testing.T) {
m := testModule(t, "plan-self-ref-multi")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -4199,8 +4200,8 @@ func TestContext2Plan_selfRefMultiAll(t *testing.T) {
m := testModule(t, "plan-self-ref-multi-all")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),

View File

@ -12,6 +12,7 @@ import (
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
)
func TestContext2Refresh(t *testing.T) {
@ -21,8 +22,8 @@ func TestContext2Refresh(t *testing.T) {
m := testModule(t, "refresh-basic")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -76,8 +77,8 @@ func TestContext2Refresh_dataComputedModuleVar(t *testing.T) {
m := testModule(t, "refresh-data-module-var")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -166,8 +167,8 @@ func TestContext2Refresh_targeted(t *testing.T) {
m := testModule(t, "refresh-targeted")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -247,8 +248,8 @@ func TestContext2Refresh_targetedCount(t *testing.T) {
m := testModule(t, "refresh-targeted-count")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -338,8 +339,8 @@ func TestContext2Refresh_targetedCountIndex(t *testing.T) {
m := testModule(t, "refresh-targeted-count")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -405,8 +406,8 @@ func TestContext2Refresh_moduleComputedVar(t *testing.T) {
m := testModule(t, "refresh-module-computed-var")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -424,8 +425,8 @@ func TestContext2Refresh_delete(t *testing.T) {
m := testModule(t, "refresh-basic")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -465,8 +466,8 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) {
m := testModule(t, "refresh-basic")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -494,8 +495,8 @@ func TestContext2Refresh_hook(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
Hooks: []Hook{h},
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -560,8 +561,8 @@ func TestContext2Refresh_modules(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -613,8 +614,8 @@ func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -631,8 +632,8 @@ func TestContext2Refresh_moduleVarModule(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -649,8 +650,8 @@ func TestContext2Refresh_noState(t *testing.T) {
m := testModule(t, "refresh-no-state")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -685,8 +686,8 @@ func TestContext2Refresh_output(t *testing.T) {
m := testModule(t, "refresh-output")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -739,8 +740,8 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
m := testModule(t, "refresh-output-partial")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -813,8 +814,8 @@ func TestContext2Refresh_stateBasic(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -866,8 +867,8 @@ func TestContext2Refresh_dataOrphan(t *testing.T) {
},
})
ctx := testContext2(t, &ContextOpts{
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),
@ -916,8 +917,8 @@ func TestContext2Refresh_dataState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),
@ -1007,8 +1008,8 @@ func TestContext2Refresh_dataStateRefData(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"null": testProviderFuncFixed(p),
},
),
@ -1051,8 +1052,8 @@ func TestContext2Refresh_tainted(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1092,8 +1093,8 @@ func TestContext2Refresh_unknownProvider(t *testing.T) {
_, diags := NewContext(&ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{},
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{},
),
State: mustShimLegacyState(&State{
Modules: []*ModuleState{
@ -1146,8 +1147,8 @@ func TestContext2Refresh_vars(t *testing.T) {
m := testModule(t, "refresh-vars")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1292,8 +1293,8 @@ func TestContext2Refresh_orphanModule(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1337,8 +1338,8 @@ func TestContext2Validate(t *testing.T) {
m := testModule(t, "validate-good")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1396,8 +1397,8 @@ func TestContext2Refresh_noDiffHookOnScaleOut(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
Hooks: []Hook{h},
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1447,8 +1448,8 @@ func TestContext2Refresh_updateProviderInState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),

View File

@ -24,6 +24,8 @@ import (
"github.com/hashicorp/terraform/flatmap"
"github.com/hashicorp/terraform/plans"
"github.com/hashicorp/terraform/plans/planfile"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/provisioners"
"github.com/hashicorp/terraform/states"
"github.com/hashicorp/terraform/states/statefile"
tfversion "github.com/hashicorp/terraform/version"
@ -349,15 +351,10 @@ func testFlatAttrDiffs(k string, i interface{}) map[string]*ResourceAttrDiff {
return diffs
}
func testProvider(prefix string) *MockResourceProvider {
p := new(MockResourceProvider)
p.RefreshFn = func(info *InstanceInfo, s *InstanceState) (*InstanceState, error) {
return s, nil
}
p.ResourcesReturn = []ResourceType{
ResourceType{
Name: fmt.Sprintf("%s_instance", prefix),
},
func testProvider(prefix string) *MockProvider {
p := new(MockProvider)
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
return providers.ReadResourceResponse{NewState: req.PriorState}
}
p.GetSchemaReturn = testProviderSchema(prefix)
@ -365,21 +362,23 @@ func testProvider(prefix string) *MockResourceProvider {
return p
}
func testProvisioner() *MockResourceProvisioner {
p := new(MockResourceProvisioner)
p.GetConfigSchemaReturnSchema = &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"command": {
Type: cty.String,
Optional: true,
},
"order": {
Type: cty.String,
Optional: true,
},
"when": {
Type: cty.String,
Optional: true,
func testProvisioner() *MockProvisioner {
p := new(MockProvisioner)
p.GetSchemaResponse = provisioners.GetSchemaResponse{
Provisioner: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"command": {
Type: cty.String,
Optional: true,
},
"order": {
Type: cty.String,
Optional: true,
},
"when": {
Type: cty.String,
Optional: true,
},
},
},
}

View File

@ -5,6 +5,7 @@ import (
"strings"
"testing"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/states"
"github.com/zclconf/go-cty/cty"
@ -26,8 +27,8 @@ func TestContext2Validate_badCount(t *testing.T) {
m := testModule(t, "validate-bad-count")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -55,8 +56,8 @@ func TestContext2Validate_badVar(t *testing.T) {
m := testModule(t, "validate-bad-var")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -86,8 +87,8 @@ func TestContext2Validate_varMapOverrideOld(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -145,8 +146,8 @@ func TestContext2Validate_computedVar(t *testing.T) {
m := testModule(t, "validate-computed-var")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
"test": testProviderFuncFixed(pt),
},
@ -161,7 +162,7 @@ func TestContext2Validate_computedVar(t *testing.T) {
return nil, c.CheckSet([]string{"value"})
}
p.ConfigureFn = func(c *ResourceConfig) error {
p.ConfigureFn = func(providers.ConfigRequest) error {
return fmt.Errorf("Configure should not be called for provider")
}
@ -195,8 +196,8 @@ func TestContext2Validate_countComputed(t *testing.T) {
m := testModule(t, "validate-count-computed")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -221,8 +222,8 @@ func TestContext2Validate_countNegative(t *testing.T) {
m := testModule(t, "validate-count-negative")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -249,8 +250,8 @@ func TestContext2Validate_countVariable(t *testing.T) {
m := testModule(t, "apply-count-variable")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -277,8 +278,8 @@ func TestContext2Validate_countVariableNoDefault(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -305,8 +306,8 @@ func TestContext2Validate_moduleBadOutput(t *testing.T) {
m := testModule(t, "validate-bad-module-output")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -333,8 +334,8 @@ func TestContext2Validate_moduleGood(t *testing.T) {
m := testModule(t, "validate-good-module")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -359,8 +360,8 @@ func TestContext2Validate_moduleBadResource(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -389,8 +390,8 @@ func TestContext2Validate_moduleDepsShouldNotCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -420,8 +421,8 @@ func TestContext2Validate_moduleProviderInheritOrphan(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -480,8 +481,8 @@ func TestContext2Validate_moduleProviderVar(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -523,8 +524,8 @@ func TestContext2Validate_moduleProviderInheritUnused(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -571,8 +572,8 @@ func TestContext2Validate_orphans(t *testing.T) {
})
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -608,8 +609,8 @@ func TestContext2Validate_providerConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -644,8 +645,8 @@ func TestContext2Validate_providerConfig_badEmpty(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -677,8 +678,8 @@ func TestContext2Validate_providerConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -707,12 +708,12 @@ func TestContext2Validate_provisionerConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
Provisioners: map[string]ResourceProvisionerFactory{
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
})
@ -753,12 +754,12 @@ func TestContext2Validate_provisionerConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
Provisioners: map[string]ResourceProvisionerFactory{
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
})
@ -784,8 +785,8 @@ func TestContext2Validate_requiredVar(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -812,8 +813,8 @@ func TestContext2Validate_resourceConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -842,8 +843,8 @@ func TestContext2Validate_resourceConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -887,8 +888,8 @@ func TestContext2Validate_tainted(t *testing.T) {
})
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -925,12 +926,12 @@ func TestContext2Validate_targetedDestroy(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
Provisioners: map[string]ResourceProvisionerFactory{
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
State: mustShimLegacyState(&State{
@ -972,8 +973,8 @@ func TestContext2Validate_varRefFilled(t *testing.T) {
}
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1018,8 +1019,8 @@ func TestContext2Validate_interpolateVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"template": testProviderFuncFixed(p),
},
),
@ -1053,8 +1054,8 @@ func TestContext2Validate_interpolateComputedModuleVarDef(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1078,8 +1079,8 @@ func TestContext2Validate_interpolateMap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"template": testProviderFuncFixed(p),
},
),
@ -1158,8 +1159,8 @@ output "out" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
@ -1194,8 +1195,8 @@ resource "aws_instance" "foo" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),

View File

@ -6,6 +6,7 @@ import (
"testing"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/providers"
"github.com/zclconf/go-cty/cty"
)
@ -45,7 +46,7 @@ func TestBuiltinEvalContextProviderInput(t *testing.T) {
func TestBuildingEvalContextInitProvider(t *testing.T) {
var lock sync.Mutex
testP := &MockResourceProvider{
testP := &MockProvider{
ResourcesReturn: []ResourceType{
{
Name: "test_thing",
@ -62,10 +63,10 @@ func TestBuildingEvalContextInitProvider(t *testing.T) {
ctx := testBuiltinEvalContext(t)
ctx.ProviderLock = &lock
ctx.ProviderCache = make(map[string]ResourceProvider)
ctx.ProviderCache = make(map[string]providers.Interface)
ctx.Components = &basicComponentFactory{
providers: map[string]ResourceProviderFactory{
"test": ResourceProviderFactoryFixed(testP),
providers: map[string]providers.Factory{
"test": providers.FactoryFixed(testP),
},
}

View File

@ -7,8 +7,9 @@ import (
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
)
func TestBuildProviderConfig(t *testing.T) {
@ -65,7 +66,7 @@ func TestEvalConfigProvider(t *testing.T) {
}),
}
provider := mockProviderWithConfigSchema(simpleTestSchema())
rp := ResourceProvider(provider)
rp := providers.Interface(provider)
n := &EvalConfigProvider{
Addr: addrs.ProviderConfig{Type: "foo"},
Config: config,
@ -99,7 +100,7 @@ func TestEvalInitProvider(t *testing.T) {
n := &EvalInitProvider{
Addr: addrs.ProviderConfig{Type: "foo"},
}
provider := &MockResourceProvider{}
provider := &MockProvider{}
ctx := &MockEvalContext{InitProviderProvider: provider}
if _, err := n.Eval(ctx); err != nil {
t.Fatalf("err: %s", err)
@ -117,7 +118,7 @@ func TestEvalCloseProvider(t *testing.T) {
n := &EvalCloseProvider{
Addr: addrs.ProviderConfig{Type: "foo"},
}
provider := &MockResourceProvider{}
provider := &MockProvider{}
ctx := &MockEvalContext{CloseProviderProvider: provider}
if _, err := n.Eval(ctx); err != nil {
t.Fatalf("err: %s", err)
@ -136,12 +137,12 @@ func TestEvalGetProvider_impl(t *testing.T) {
}
func TestEvalGetProvider(t *testing.T) {
var actual ResourceProvider
var actual providers.Interface
n := &EvalGetProvider{
Addr: addrs.RootModuleInstance.ProviderConfigDefault("foo"),
Output: &actual,
}
provider := &MockResourceProvider{}
provider := &MockProvider{}
ctx := &MockEvalContext{ProviderProvider: provider}
if _, err := n.Eval(ctx); err != nil {
t.Fatalf("err: %s", err)

View File

@ -2,6 +2,8 @@ package terraform
import (
"testing"
"github.com/hashicorp/terraform/provisioners"
)
func TestEvalInitProvisioner_impl(t *testing.T) {
@ -10,7 +12,7 @@ func TestEvalInitProvisioner_impl(t *testing.T) {
func TestEvalInitProvisioner(t *testing.T) {
n := &EvalInitProvisioner{Name: "foo"}
provisioner := &MockResourceProvisioner{}
provisioner := &MockProvisioner{}
ctx := &MockEvalContext{InitProvisionerProvisioner: provisioner}
if _, err := n.Eval(ctx); err != nil {
t.Fatalf("err: %s", err)
@ -26,7 +28,7 @@ func TestEvalInitProvisioner(t *testing.T) {
func TestEvalCloseProvisioner(t *testing.T) {
n := &EvalCloseProvisioner{Name: "foo"}
provisioner := &MockResourceProvisioner{}
provisioner := &MockProvisioner{}
ctx := &MockEvalContext{CloseProvisionerProvisioner: provisioner}
if _, err := n.Eval(ctx); err != nil {
t.Fatalf("err: %s", err)
@ -45,9 +47,9 @@ func TestEvalGetProvisioner_impl(t *testing.T) {
}
func TestEvalGetProvisioner(t *testing.T) {
var actual ResourceProvisioner
var actual provisioners.Interface
n := &EvalGetProvisioner{Name: "foo", Output: &actual}
provisioner := &MockResourceProvisioner{}
provisioner := &MockProvisioner{}
ctx := &MockEvalContext{ProvisionerProvisioner: provisioner}
if _, err := n.Eval(ctx); err != nil {
t.Fatalf("err: %s", err)

View File

@ -8,6 +8,7 @@ import (
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/states"
)
@ -96,7 +97,7 @@ func TestEvalReadState(t *testing.T) {
},
})
providerSchema := mockProvider.GetSchemaReturn
provider := ResourceProvider(mockProvider)
provider := providers.Interface(mockProvider)
cases := map[string]struct {
Resources map[string]*ResourceState

View File

@ -10,8 +10,10 @@ import (
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/provisioners"
"github.com/hashicorp/terraform/tfdiags"
)
@ -30,7 +32,7 @@ func TestEvalValidateResource_managedResource(t *testing.T) {
return
}
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_object",
@ -78,7 +80,7 @@ func TestEvalValidateResource_managedResourceCount(t *testing.T) {
return
}
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_object",
@ -127,7 +129,7 @@ func TestEvalValidateResource_dataSource(t *testing.T) {
return
}
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.DataResourceMode,
Type: "test_object",
@ -167,7 +169,7 @@ func TestEvalValidateResource_validReturnsNilError(t *testing.T) {
return
}
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_object",
@ -202,7 +204,7 @@ func TestEvalValidateResource_warningsAndErrorsPassedThrough(t *testing.T) {
return
}
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_object",
@ -249,7 +251,7 @@ func TestEvalValidateResource_ignoreWarnings(t *testing.T) {
return
}
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_object",
@ -286,7 +288,7 @@ func TestEvalValidateResource_invalidDependsOn(t *testing.T) {
// We'll check a _valid_ config first, to make sure we're not failing
// for some other reason, and then make it invalid.
p := ResourceProvider(mp)
p := providers.Interface(mp)
rc := &configs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_object",
@ -355,8 +357,8 @@ func TestEvalValidateResource_invalidDependsOn(t *testing.T) {
}
func TestEvalValidateProvisioner_valid(t *testing.T) {
mp := &MockResourceProvisioner{}
var p ResourceProvisioner = mp
mp := &MockProvisioner{}
var p provisioners.Interface = mp
ctx := &MockEvalContext{}
ctx.installSimpleEval()
@ -394,8 +396,8 @@ func TestEvalValidateProvisioner_valid(t *testing.T) {
}
func TestEvalValidateProvisioner_warning(t *testing.T) {
mp := &MockResourceProvisioner{}
var p ResourceProvisioner = mp
mp := &MockProvisioner{}
var p provisioners.Interface = mp
ctx := &MockEvalContext{}
ctx.installSimpleEval()
@ -446,7 +448,7 @@ func TestEvalValidateProvisioner_warning(t *testing.T) {
}
func TestEvalValidateProvisioner_connectionInvalid(t *testing.T) {
var p ResourceProvisioner = &MockResourceProvisioner{}
var p provisioners.Interface = &MockProvisioner{}
ctx := &MockEvalContext{}
ctx.installSimpleEval()

View File

@ -5,7 +5,7 @@ import (
"testing"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
)
func TestPlanGraphBuilder_impl(t *testing.T) {
@ -13,28 +13,30 @@ func TestPlanGraphBuilder_impl(t *testing.T) {
}
func TestPlanGraphBuilder(t *testing.T) {
awsProvider := &MockResourceProvider{
GetSchemaReturn: &ProviderSchema{
Provider: simpleTestSchema(),
ResourceTypes: map[string]*configschema.Block{
"aws_security_group": simpleTestSchema(),
"aws_instance": simpleTestSchema(),
"aws_load_balancer": simpleTestSchema(),
awsProvider := &MockProvider{
GetSchemaResponse: provider.GetSchemaResponse{
Provider: providers.Schema{
Block: simpleTestSchema(),
},
ResourceTypes: map[string]providers.Schema{
"aws_security_group": {Block: simpleTestSchema()},
"aws_instance": {Block: simpleTestSchema()},
"aws_load_balancer": {Block: simpleTestSchema()},
},
},
}
openstackProvider := &MockResourceProvider{
GetSchemaReturn: &ProviderSchema{
Provider: simpleTestSchema(),
ResourceTypes: map[string]*configschema.Block{
"openstack_floating_ip": simpleTestSchema(),
openstackProvider := &MockProvider{
GetSchemaResponse: providers.GetSchemaResponse{
Provider: providers.Schema{Block: simpleTestSchema()},
ResourceTypes: map[string]providers.Schema{
"openstack_floating_ip": {Block: simpleTestSchema()},
},
},
}
components := &basicComponentFactory{
providers: map[string]ResourceProviderFactory{
"aws": ResourceProviderFactoryFixed(awsProvider),
"openstack": ResourceProviderFactoryFixed(openstackProvider),
providers: map[string]providers.Factory{
"aws": providers.FactoryFixed(awsProvider),
"openstack": providers.FactoryFixed(openstackProvider),
},
}

View File

@ -4,6 +4,7 @@ import (
"testing"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/zclconf/go-cty/cty"
)
@ -14,47 +15,53 @@ func TestMockResourceProvider_impl(t *testing.T) {
// testProviderComponentFactory creates a componentFactory that contains only
// a single given.
func testProviderComponentFactory(name string, provider ResourceProvider) *basicComponentFactory {
func testProviderComponentFactory(name string, provider providers.Interface) *basicComponentFactory {
return &basicComponentFactory{
providers: map[string]ResourceProviderFactory{
name: ResourceProviderFactoryFixed(provider),
providers: map[string]providers.Factory{
name: providers.FactoryFixed(provider),
},
}
}
// mockProviderWithConfigSchema is a test helper to concisely create a mock
// provider with the given schema for its own configuration.
func mockProviderWithConfigSchema(schema *configschema.Block) *MockResourceProvider {
return &MockResourceProvider{
GetSchemaReturn: &ProviderSchema{
Provider: schema,
func mockProviderWithConfigSchema(schema *configschema.Block) *MockProvider {
return &MockProvider{
GetSchemaResponse: providers.GetSchemaResponse{
Provider: providers.Schema{
Block: schema,
},
},
}
}
// mockProviderWithResourceTypeSchema is a test helper to concisely create a mock
// provider with a schema containing a single resource type.
func mockProviderWithResourceTypeSchema(name string, schema *configschema.Block) *MockResourceProvider {
return &MockResourceProvider{
GetSchemaReturn: &ProviderSchema{
Provider: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"string": {
Type: cty.String,
Optional: true,
},
"list": {
Type: cty.List(cty.String),
Optional: true,
},
"root": {
Type: cty.Map(cty.String),
Optional: true,
func mockProviderWithResourceTypeSchema(name string, schema *configschema.Block) *MockProvider {
return &MockProvider{
GetSchemaResponse: providers.GetSchemaResponse{
Provider: providers.Schema{
Block: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"string": {
Type: cty.String,
Optional: true,
},
"list": {
Type: cty.List(cty.String),
Optional: true,
},
"root": {
Type: cty.Map(cty.String),
Optional: true,
},
},
},
},
ResourceTypes: map[string]*configschema.Block{
name: schema,
ResourceTypes: map[string]providers.Schema{
name: {
Block: schema,
},
},
},
}
@ -72,7 +79,7 @@ func mockProviderWithDataSourceSchema(name string, schema *configschema.Block) *
}
}
// simpleMockProvider returns a MockResourceProvider that is pre-configured
// simpleMockProvider returns a MockProvider that is pre-configured
// with schema for its own config, for a resource type called "test_object" and
// for a data source also called "test_object".
//
@ -89,15 +96,21 @@ func mockProviderWithDataSourceSchema(name string, schema *configschema.Block) *
// the default schema stored in the field GetSchemaReturn. Each new call to
// simpleTestProvider produces entirely new instances of all of the nested
// objects so that callers can mutate without affecting mock objects.
func simpleMockProvider() *MockResourceProvider {
return &MockResourceProvider{
GetSchemaReturn: &ProviderSchema{
Provider: simpleTestSchema(),
ResourceTypes: map[string]*configschema.Block{
"test_object": simpleTestSchema(),
func simpleMockProvider() *MockProvider {
return &MockProvider{
GetSchemaResponse: providers.GetSchemaResponse{
Provider: providers.Schema{
Block: simpleTestSchema(),
},
DataSources: map[string]*configschema.Block{
"test_object": simpleTestSchema(),
ResourceTypes: map[string]providers.Schema{
"test_object": {
Block: simpleTestSchema(),
},
},
DataSources: map[string]providers.Schema{
"test_object": {
Block: simpleTestSchema(),
},
},
},
}

View File

@ -2,13 +2,15 @@ package terraform
import (
"testing"
"github.com/hashicorp/terraform/provisioners"
)
func TestMockResourceProvisioner_impl(t *testing.T) {
var _ ResourceProvisioner = new(MockResourceProvisioner)
}
// simpleMockProvisioner returns a MockResourceProvisioner that is pre-configured
// simpleMockProvisioner returns a MockProvisioner that is pre-configured
// with schema for its own config, with the same content as returned by
// function simpleTestSchema.
//
@ -22,8 +24,10 @@ func TestMockResourceProvisioner_impl(t *testing.T) {
// the default schema stored in the field GetSchemaReturn. Each new call to
// simpleTestProvisioner produces entirely new instances of all of the nested
// objects so that callers can mutate without affecting mock objects.
func simpleMockProvisioner() *MockResourceProvisioner {
return &MockResourceProvisioner{
GetConfigSchemaReturnSchema: simpleTestSchema(),
func simpleMockProvisioner() *MockProvisioner {
return &MockProvisioner{
GetSchemaResponse: provisioners.GetSchemaResponse{
Provisioner: simpleTestSchema(),
},
}
}

View File

@ -20,6 +20,8 @@ import (
"github.com/hashicorp/terraform/helper/experiment"
"github.com/hashicorp/terraform/helper/logging"
"github.com/hashicorp/terraform/plans"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/provisioners"
"github.com/hashicorp/terraform/states"
)
@ -165,14 +167,14 @@ func testModuleInline(t *testing.T, sources map[string]string) *configs.Config {
return config
}
func testProviderFuncFixed(rp ResourceProvider) ResourceProviderFactory {
return func() (ResourceProvider, error) {
func testProviderFuncFixed(rp providers.Interface) providers.Factory {
return func() (providers.Interface, error) {
return rp, nil
}
}
func testProvisionerFuncFixed(rp ResourceProvisioner) ResourceProvisionerFactory {
return func() (ResourceProvisioner, error) {
func testProvisionerFuncFixed(rp provisioners.Interface) ProvisionerFactory {
return func() (provisioners.Interface, error) {
return rp, nil
}
}