https://github.com/snyk/snyk-iac-parsers
This golang project contains the file parsing functionality used in Snyk Infrastructure as Code.
https://github.com/snyk/snyk-iac-parsers
infrastructure-as-code
Last synced: 2 months ago
JSON representation
This golang project contains the file parsing functionality used in Snyk Infrastructure as Code.
- Host: GitHub
- URL: https://github.com/snyk/snyk-iac-parsers
- Owner: snyk
- License: mpl-2.0
- Created: 2021-11-23T08:07:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-01T14:47:26.000Z (3 months ago)
- Last Synced: 2025-04-01T15:43:07.601Z (3 months ago)
- Topics: infrastructure-as-code
- Language: Go
- Homepage:
- Size: 1.41 MB
- Stars: 1
- Watchers: 72
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# snyk-iac-parsers
---[](https://circleci.com/gh/snyk/snyk-iac-parsers/tree/main)
[](https://img.shields.io/github/workflow/status/snyk/snyk-iac-parsers/Policies%20Regression%20Test?label=regression%20tests)[](https://github.com/snyk/snyk-iac-parsers)
[](https://github.com/snyk/snyk-iac-rules)[](https://github.com/snyk/snyk-iac-parsers)
---This project includes parsers that are used for Snyk Infrastructure As Code product. Parsers convert the files they take as input into JSON.
## Supported formats
The following file formats are supported:
- HCL2: [Terraform](https://www.terraform.io/)'s default configuration format, parser's source can be found [here](http://https://github.com/snyk/snyk-iac-parsers/blob/main/pkg/hcl2.go).
- Terraform Plan(JSON): [Terraform plan output in json](https://www.terraform.io/docs/internals/json-format.html) is parsed and ``resource_changes`` element is extracted. Parser's source can be found [here](https://github.com/snyk/snyk-iac-parsers/blob/main/pkg/terraform_plan.go).
- YAML: Parser's source can be found [here](https://github.com/snyk/snyk-iac-parsers/blob/main/pkg/yaml.go).All the formats above are transformed into JSON so that they can be used as input into tools such as [Open Policy Agent](https://www.openpolicyagent.org/).
## Development
Tests can be run using the `go test` command:
```bash
% go test ./...
```Before committing code should be formatted with `go fmt` and linted with `golangci-lint run`. The CircleCI runner will enforce this for each opened pull request.
## Contributing
This project is developed in open as a dependency of the [snyk/snyk-iac-rules](https://github.com/snyk/snyk-iac-rules) project. Should you wish to make a contribution please open a pull request against this repository with a clear description of the change with tests demonstrating the functionality. You will also need to agree to the [Contributor Agreement](./Contributor-Agreement.md) before the code can be accepted and merged.
## License
Available under the [Mozilla Public License 2.0](./LICENSE.md)