Skip to content

Commit

Permalink
fix(terraform): remove resource reference in dependent policies (#5684)
Browse files Browse the repository at this point in the history
* stage

* remove user issue

* fix unit tests

* Fix Unit Tests

* stage

* update

* update comment and code

* fix data_source_test_go
  • Loading branch information
cxMiguelSilva authored Aug 25, 2022
1 parent cbb23fb commit 033fb20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27,856 deletions.
12 changes: 9 additions & 3 deletions pkg/parser/terraform/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,16 @@ func parseDataSourceBody(body *hclsyntax.Body) string {
Variables: inputVariableMap,
Functions: functions.TerraformFuncs,
})
if decodeErrs != nil {
log.Debug().Msg("Error trying to eval data source block.")
return ""

// check decode errors
for _, decErr := range decodeErrs {
if decErr.Summary != "Unknown variable" {
log.Debug().Msg("Error trying to eval data source block.")
return ""
}
log.Debug().Msg("Dismissed Error when decoding policy: Found unknown variable")
}

dataSourceJSON := decodeDataSourcePolicy(target)
convertedDataSource := convertedPolicy{
ID: dataSourceJSON.ID,
Expand Down
1 change: 1 addition & 0 deletions pkg/parser/terraform/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func setInputVariablesDefaultValues(filename string) (converter.VariableMap, err
},
},
})

defaultValuesMap := make(converter.VariableMap)
for _, block := range content.Blocks {
if len(block.Labels) == 0 || block.Labels[0] == "" {
Expand Down
Loading

0 comments on commit 033fb20

Please sign in to comment.