Skip to content

Commit

Permalink
chore: downgrade the failed block expand message to debug (aquasecuri…
Browse files Browse the repository at this point in the history
…ty#7964)

Signed-off-by: nikpivkin <[email protected]>
  • Loading branch information
nikpivkin authored Nov 23, 2024
1 parent de3b7ea commit 32951f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/iac/scanners/terraform/parser/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (e *evaluator) expandBlocks(blocks terraform.Blocks) terraform.Blocks {
func (e *evaluator) expandDynamicBlocks(blocks ...*terraform.Block) terraform.Blocks {
for _, b := range blocks {
if err := b.ExpandBlock(); err != nil {
e.logger.Error(`Failed to expand dynamic block.`,
e.logger.Debug(`Failed to expand dynamic block.`,
log.String("block", b.FullName()), log.Err(err))
}
}
Expand Down Expand Up @@ -297,7 +297,7 @@ func (e *evaluator) expandBlockForEaches(blocks terraform.Blocks) terraform.Bloc
forEachVal := forEachAttr.Value()

if forEachVal.IsNull() || !forEachVal.IsKnown() || !forEachAttr.IsIterable() {
e.logger.Error(`Failed to expand block. Invalid "for-each" argument. Must be known and iterable.`,
e.logger.Debug(`Failed to expand block. Invalid "for-each" argument. Must be known and iterable.`,
log.String("block", block.FullName()),
log.String("value", forEachVal.GoString()),
)
Expand All @@ -314,7 +314,7 @@ func (e *evaluator) expandBlockForEaches(blocks terraform.Blocks) terraform.Bloc
// instances are identified by a map key (or set member) from the value provided to for_each
idx, err := convert.Convert(key, cty.String)
if err != nil {
e.logger.Error(
e.logger.Debug(
`Failed to expand block. Invalid "for-each" argument: map key (or set value) is not a string`,
log.String("block", block.FullName()),
log.String("key", key.GoString()),
Expand All @@ -331,7 +331,7 @@ func (e *evaluator) expandBlockForEaches(blocks terraform.Blocks) terraform.Bloc
!forEachVal.Type().IsMapType() {
stringVal, err := convert.Convert(val, cty.String)
if err != nil {
e.logger.Error(
e.logger.Debug(
"Failed to expand block. Invalid 'for-each' argument: value is not a string",
log.String("block", block.FullName()),
log.String("key", idx.AsString()),
Expand Down

0 comments on commit 32951f9

Please sign in to comment.