make blocktoattr an hcldec.UnknownBody

This will allow any dynamic blocks that are fixed up as a blocktoattr
still decode into an unknown value.
This commit is contained in:
James Bardin 2021-04-13 18:42:15 -04:00
parent b7fb533bd2
commit b515ab583a
1 changed files with 11 additions and 0 deletions

View File

@ -41,6 +41,17 @@ type fixupBody struct {
names map[string]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 // 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, // representation of the same schema that was previously passed to FixUpBlockAttrs,
// or else the result is undefined. // or else the result is undefined.