|
|
|
|
@@ -57,7 +57,7 @@ func TestContext2Refresh(t *testing.T) {
|
|
|
|
|
NewState: readState,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatal(diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -137,7 +137,7 @@ func TestContext2Refresh_dynamicAttr(t *testing.T) {
|
|
|
|
|
schema := p.GetProviderSchemaResponse.ResourceTypes["test_instance"].Block
|
|
|
|
|
ty := schema.ImpliedType()
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, startingState, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, startingState, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatal(diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -281,7 +281,7 @@ func TestContext2Refresh_targeted(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{
|
|
|
|
|
Mode: plans.NormalMode,
|
|
|
|
|
Targets: []addrs.Targetable{
|
|
|
|
|
addrs.RootModuleInstance.Resource(
|
|
|
|
|
@@ -368,7 +368,7 @@ func TestContext2Refresh_excluded(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{
|
|
|
|
|
Mode: plans.NormalMode,
|
|
|
|
|
Excludes: []addrs.Targetable{
|
|
|
|
|
addrs.RootModuleInstance.Resource(
|
|
|
|
|
@@ -452,7 +452,7 @@ func TestContext2Refresh_targetedCount(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{
|
|
|
|
|
Mode: plans.NormalMode,
|
|
|
|
|
Targets: []addrs.Targetable{
|
|
|
|
|
addrs.RootModuleInstance.Resource(
|
|
|
|
|
@@ -545,7 +545,7 @@ func TestContext2Refresh_excludedCount(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{
|
|
|
|
|
Mode: plans.NormalMode,
|
|
|
|
|
Excludes: []addrs.Targetable{
|
|
|
|
|
addrs.RootModuleInstance.Resource(
|
|
|
|
|
@@ -633,7 +633,7 @@ func TestContext2Refresh_targetedCountIndex(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{
|
|
|
|
|
Mode: plans.NormalMode,
|
|
|
|
|
Targets: []addrs.Targetable{
|
|
|
|
|
addrs.RootModuleInstance.ResourceInstance(
|
|
|
|
|
@@ -720,7 +720,7 @@ func TestContext2Refresh_excludedCountIndex(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{
|
|
|
|
|
Mode: plans.NormalMode,
|
|
|
|
|
Excludes: []addrs.Targetable{
|
|
|
|
|
addrs.RootModuleInstance.ResourceInstance(
|
|
|
|
|
@@ -769,7 +769,7 @@ func TestContext2Refresh_moduleComputedVar(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
// This was failing (see GH-2188) at some point, so this test just
|
|
|
|
|
// verifies that the failure goes away.
|
|
|
|
|
if _, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
if _, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errs: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -792,7 +792,7 @@ func TestContext2Refresh_delete(t *testing.T) {
|
|
|
|
|
NewState: cty.NullVal(p.GetProviderSchemaResponse.ResourceTypes["aws_instance"].Block.ImpliedType()),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -818,7 +818,7 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) {
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -843,7 +843,7 @@ func TestContext2Refresh_hook(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if _, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
if _, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errs: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
if !h.PreRefreshCalled {
|
|
|
|
|
@@ -888,7 +888,7 @@ func TestContext2Refresh_modules(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -928,7 +928,7 @@ func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if _, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
if _, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errs: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -942,7 +942,7 @@ func TestContext2Refresh_moduleVarModule(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if _, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
if _, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errs: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -963,7 +963,7 @@ func TestContext2Refresh_noState(t *testing.T) {
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if _, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
if _, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode}); diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errs: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1003,7 +1003,7 @@ func TestContext2Refresh_output(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1051,7 +1051,7 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1091,7 +1091,7 @@ func TestContext2Refresh_stateBasic(t *testing.T) {
|
|
|
|
|
NewState: readStateVal,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1147,7 +1147,7 @@ func TestContext2Refresh_dataCount(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
@@ -1193,7 +1193,7 @@ func TestContext2Refresh_dataState(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1256,7 +1256,7 @@ func TestContext2Refresh_dataStateRefData(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1291,7 +1291,7 @@ func TestContext2Refresh_tainted(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1322,7 +1322,7 @@ func TestContext2Refresh_unknownProvider(t *testing.T) {
|
|
|
|
|
})
|
|
|
|
|
assertNoDiagnostics(t, diags)
|
|
|
|
|
|
|
|
|
|
_, diags = c.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
_, diags = c.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if !diags.HasErrors() {
|
|
|
|
|
t.Fatal("successfully refreshed; want error")
|
|
|
|
|
}
|
|
|
|
|
@@ -1381,7 +1381,7 @@ func TestContext2Refresh_vars(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("refresh errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1461,7 +1461,7 @@ func TestContext2Refresh_orphanModule(t *testing.T) {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
testCheckDeadlock(t, func() {
|
|
|
|
|
_, err := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
_, err := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("err: %s", err.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1526,7 +1526,7 @@ aws_instance.bar:
|
|
|
|
|
ID = foo
|
|
|
|
|
provider = provider["registry.opentofu.org/hashicorp/aws"].foo`)
|
|
|
|
|
|
|
|
|
|
s, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
s, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatal(diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1589,7 +1589,7 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
state, diags := ctx.Refresh(m, s, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
state, diags := ctx.Refresh(context.Background(), m, s, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatal(diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1672,7 +1672,7 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
state, diags := ctx.Refresh(m, s, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
state, diags := ctx.Refresh(context.Background(), m, s, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatal(diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1728,7 +1728,7 @@ data "aws_data_source" "foo" {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, states.NewState(), &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
// Should get this error:
|
|
|
|
|
// Unsupported attribute: This object does not have an attribute named "missing"
|
|
|
|
|
@@ -1776,7 +1776,7 @@ func TestContext2Refresh_dataResourceDependsOn(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("unexpected errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1821,7 +1821,7 @@ resource "aws_instance" "bar" {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
state, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
state, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatalf("plan errors: %s", diags.Err())
|
|
|
|
|
}
|
|
|
|
|
@@ -1868,7 +1868,7 @@ func TestContext2Refresh_dataSourceOrphan(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_, diags := ctx.Refresh(m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
_, diags := ctx.Refresh(context.Background(), m, state, &PlanOpts{Mode: plans.NormalMode})
|
|
|
|
|
if diags.HasErrors() {
|
|
|
|
|
t.Fatal(diags.Err())
|
|
|
|
|
}
|
|
|
|
|
|