From 91d2de6a25b5ef8761635daa629c680d026da873 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 9 Oct 2018 16:32:09 -0700 Subject: [PATCH] backend/local: Stub out remaining planfile todos with errors This is just to make sure they show up later when we are working on the tests, so we can be sure not to forget to address them. --- backend/local/backend_local.go | 21 ++++++++++++++++++--- backend/local/backend_plan_test.go | 4 ++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/backend/local/backend_local.go b/backend/local/backend_local.go index 33e539c8fc..b7fadef683 100644 --- a/backend/local/backend_local.go +++ b/backend/local/backend_local.go @@ -195,9 +195,24 @@ func (b *Local) contextFromPlanFile(pf *planfile.Reader, opts terraform.ContextO opts.Variables = variables opts.Changes = plan.Changes - // TODO: targets - // TODO: check that the states match - // TODO: impose provider SHA256 constraints + // There are some remaining things to reinstate here after refactoring. + // These are just warnings for now so we can work on other tasks without + // forgetting to deal with these. + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Targets not yet implemented when reading from plan file", + "TODO: Need to deal with any -target arguments recorded in the plan file.", + )) + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Plan state lineage checking not yet implemented", + "TODO: Need to check that the state recorded in the plan matches the current state, and fail if not.", + )) + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Provider SHA256 checks not yet implemented", + "TODO: Need to register our saved provider SHA256 hashes with the provider resolver to ensure we get the same binaries that created this plan.", + )) tfCtx, ctxDiags := terraform.NewContext(&opts) diags = diags.Append(ctxDiags) diff --git a/backend/local/backend_plan_test.go b/backend/local/backend_plan_test.go index 541a58ad8a..a5643b3216 100644 --- a/backend/local/backend_plan_test.go +++ b/backend/local/backend_plan_test.go @@ -183,7 +183,7 @@ func TestLocal_planDestroy(t *testing.T) { } op.PlanOutBackend = &plans.Backend{ // Just a placeholder so that we can generate a valid plan file. - Type: "local", + Type: "local", Config: cfgRaw, } @@ -234,7 +234,7 @@ func TestLocal_planOutPathNoChange(t *testing.T) { } op.PlanOutBackend = &plans.Backend{ // Just a placeholder so that we can generate a valid plan file. - Type: "local", + Type: "local", Config: cfgRaw, }