Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://elementtech.github.io/terracove/
Recursively test a directory tree for Terraform diffs and coverage
https://elementtech.github.io/terracove/
iac infrastructure infrastructure-as-code terraform terragrunt terratest testing
Last synced: about 1 month ago
JSON representation
Recursively test a directory tree for Terraform diffs and coverage
- Host: GitHub
- URL: https://elementtech.github.io/terracove/
- Owner: ElementTech
- License: mit
- Created: 2023-04-08T17:49:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-18T07:08:07.000Z (over 1 year ago)
- Last Synced: 2024-08-02T00:26:35.767Z (4 months ago)
- Topics: iac, infrastructure, infrastructure-as-code, terraform, terragrunt, terratest, testing
- Language: Go
- Homepage: https://elementtech.github.io/terracove/
- Size: 404 KB
- Stars: 46
- Watchers: 1
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-tf - terracove - Recursively test a directory tree for Terraform diffs and coverage. (Tools / Community providers)
README
A recursive terraform repository tester powered by Terratest.
Key Features •
Install •
Usage •
Quickstart •
Credits •
Support •
License![screenshot](./assets/example.png)
## Key Features
* Test in parallel multiple directory paths
* Export Results:
* [junit](./examples/terracove.xml) with `--junit`
* [json](./examples/terracove.json) summary with `--json`
* [html](./examples/terracove.html) report with `--html`
* Generate `%` coverage for each module and root directory
* Ignore Errors and Empty Modules
* Supports [terraform](https://www.terraform.io/) and [terragrunt](https://terragrunt.gruntwork.io/) in the same directory tree## Install
The recommended way to install on MacOS is via brew:
```sh
brew tap elementtech/elementtech
brew install terracove
```If you'd like to use Docker, you can use the official image:
```sh
docker run --rm -v $(pwd):/data ghcr.io/elementtech/terracove /data --json --junit --html
```Or, you can install directly from release:
```sh
curl -sS https://raw.githubusercontent.com/elementtech/terracove/main/install.sh | bash
```
## Usage```sh
Usage:
terracove [paths]... [flags]Flags:
-e, --exclude strings Exclude directories while parsing tree
-h, --help help for terracove
-w, --html Output HTML Report
--ignore-empty Ignore Modules with 0 Resources
--ignore-errors Ignore Planning Errors
-j, --json Output JSON
-x, --junit Output Junit XML
--minimal Don't Append Raw/JSON Plan to the Exported Output
--o-html string Output HTML Report File (default "terracove.html")
--o-json string Output JSON File (default "terracove.json")
--o-junit string Output Junit XML File (default "terracove.xml")
-t, --validate-tf-by string validate terraform by the existence of [filename] in a directory (default "main.tf")
-g, --validate-tg-by string validate terragrunt by the existence of [filename] in a directory (default "terragrunt.hcl")
-v, --version version for terracove
```## Quickstart
> Note that you must have terraform/terragrunt binaries installed on your machine> The [examples](./examples) directory contains **4 modules**. 2 of them are [terraform](./examples/terraform) and 2 are [terragrunt](./examples/terragrunt).
>
> **Oh no!** It appears some of them have some problems. Let's see exactly what is going on.
> Clone this repository and give it a try.```sh
git clone https://github.com/elementtech/terracove.git
cd terracove
terracove --minimal --junit --json --html .
# . == examples == examples/terraform examples/terragrunt
```Open the **terracove.xml**, **terracove.json** or **terracove.html** and observe the results. You should see the following:
```json
[
{
"Timestamp": "1984-01-01T19:32:58+05:00",
"Path": ".",
"Results": [
{
"Path": "examples/terragrunt/no-resources",
"ResourceCount": 0,
"Coverage": 100,
...
},
{
"Path": "examples/terragrunt/error",
"Coverage": 0,
...
},
{
"Path": "examples/terraform/tfstate-diff",
"ResourceCount": 2,
"ResourceCountDiff": 1,
"Coverage": 50,
...
},
{
"Path": "examples/terraform/success",
"ResourceCount": 2,
"ResourceCountExists": 2,
"Coverage": 100,
...
}
],
"Coverage": 62.5
}
]
```## Credits
This project uses or is inspired by the following open source projects:
- [golang-cli-template](https://github.com/FalcoSuessgott/golang-cli-template)
- [terratest](https://terratest.gruntwork.io/)
- [docker-terragrunt](https://github.com/devops-infra/docker-terragrunt)
- [junit2html](https://github.com/kitproj/junit2html)
## Support## License
[MIT](LICENSE)