Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add structs for validate output #23

Merged
merged 1 commit into from
Dec 7, 2020

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Dec 7, 2020

As mentioned in the comments the JSON output for terraform validate was introduced in 0.12 and (according to git blame on the relevant LOC) the format has not changed since the introduction, so there should be no need to account for any such changes:
hashicorp/terraform@9a004e3

I did briefly considered making Severity a custom type and add constants for error and warning (and whether other values there might be), but then I thought perhaps for compatibility reasons these structs should not be stricter than the actual implementation. That said I'm still not opposed to adding it.

Supports hashicorp/terraform-exec#68


This PR also introduces go-cmp as a (test) dependency, which AFAIK is a library commonly used in the TF ecosystem and core. It can produce a human-readable output, just like spew, but even more readable as it displays diff, rather than two structs.

I'd be happy to raise a follow-up PR to replace spew entirely with go-cmp throughout the codebase.

@vancluever vancluever merged commit 5001406 into hashicorp:master Dec 7, 2020
@radeksimko radeksimko deleted the validate-output branch December 7, 2020 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants