Skip to content

Commit

Permalink
remove unused code, fix a few typos in README
Browse files Browse the repository at this point in the history
  • Loading branch information
lhitchon committed Mar 8, 2018
1 parent fc08f53 commit e876b96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -5,7 +5,7 @@ Validate a terraform HCL file using rules specified in a YAML file.
# Run

```
go run app.go --terraform files/terraform.hcl
go run app.go files/terraform.hcl
```

# Rules
Expand All @@ -24,7 +24,7 @@ If a directory name is given, load all the files in that directory. Maybe allow

# Filters

Each filter contains the following attirbutes:
Each filter contains the following attributes:

* type: everything should be "value" for now
* key: the JMES path used to find data in a resource
Expand Down Expand Up @@ -58,5 +58,5 @@ Lots to do. This is just a proof-of-concept.
* Improve output - table format, JSON format
* Add value_from to allow for dynamic data (again, see CloudCustodian)
* Add ability to extend with a Lambda function
* Add command line paramter for rules file or directory (currently hard-coded)
* Add command line parameter for rules file or directory (currently hard-coded)
* It's already big enough to warrant some automated tests
16 changes: 0 additions & 16 deletions app.go
Expand Up @@ -23,22 +23,6 @@ func makeLogger(verbose bool) LoggingFunction {
return func(message string) {}
}

func loadYAML(template string, log LoggingFunction) map[string]interface{} {
jsonData, err := yaml.YAMLToJSON([]byte(template))
if err != nil {
panic(err)
}
log(string(jsonData))

var data interface{}
err = yaml.Unmarshal(jsonData, &data)
if err != nil {
panic(err)
}
m := data.(map[string]interface{})
return m["Resources"].(map[string]interface{})
}

func loadHCL(template string, log LoggingFunction) []interface{} {
var v interface{}
err := hcl.Unmarshal([]byte(template), &v)
Expand Down

0 comments on commit e876b96

Please sign in to comment.