From b515ab583a50b88c08210e0177fed44f9eade089 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 13 Apr 2021 18:42:15 -0400 Subject: [PATCH] make blocktoattr an hcldec.UnknownBody This will allow any dynamic blocks that are fixed up as a blocktoattr still decode into an unknown value. --- lang/blocktoattr/fixup.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lang/blocktoattr/fixup.go b/lang/blocktoattr/fixup.go index 0af708ec4..056946ab9 100644 --- a/lang/blocktoattr/fixup.go +++ b/lang/blocktoattr/fixup.go @@ -41,6 +41,17 @@ type fixupBody struct { names map[string]struct{} } +type unknownBlock interface { + Unknown() bool +} + +func (b *fixupBody) Unknown() bool { + if u, ok := b.original.(unknownBlock); ok { + return u.Unknown() + } + return false +} + // Content decodes content from the body. The given schema must be the lower-level // representation of the same schema that was previously passed to FixUpBlockAttrs, // or else the result is undefined.