From c34c37fbd57d0cc27de4cf338ef4ea638b67d727 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 13 Feb 2019 19:01:55 -0500 Subject: [PATCH] missed .% suffixes in diff.Apply Diff.Apply checks for unneeded container count diffs, but was missing the check for maps. Add an early return for planning a destroy. --- helper/plugin/grpc_provider.go | 6 ++++++ terraform/diff.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/helper/plugin/grpc_provider.go b/helper/plugin/grpc_provider.go index be3d2f9898..b880661bda 100644 --- a/helper/plugin/grpc_provider.go +++ b/helper/plugin/grpc_provider.go @@ -498,6 +498,12 @@ func (s *GRPCProviderServer) PlanResourceChange(_ context.Context, req *proto.Pl return resp, nil } + // We don't usually plan destroys, but this can return early in any case. + if proposedNewStateVal.IsNull() { + resp.PlannedState = req.ProposedNewState + return resp, nil + } + info := &terraform.InstanceInfo{ Type: req.TypeName, } diff --git a/terraform/diff.go b/terraform/diff.go index f87db081fc..e68f3d81ef 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -546,7 +546,7 @@ func (d *InstanceDiff) applyBlockDiff(path []string, attrs map[string]string, sc } // check for empty "count" keys - if strings.HasSuffix(attr, ".#") && diff.New == "0" { + if (strings.HasSuffix(attr, ".#") || strings.HasSuffix(attr, ".%")) && diff.New == "0" { continue }