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

Plan/Apply -json support missing #183

Open
thrashr888 opened this issue May 25, 2021 · 2 comments · May be fixed by #275
Open

Plan/Apply -json support missing #183

thrashr888 opened this issue May 25, 2021 · 2 comments · May be fixed by #275
Labels
enhancement New feature or request
Milestone

Comments

@thrashr888
Copy link
Member

Plans and applies now support streaming json with the -json flag. Adding support for the flag may not be enough--including streamed data structures from stdout would be preferred.

@radeksimko radeksimko added the enhancement New feature or request label Jul 1, 2021
@kmoe kmoe added this to the v1.0.0 milestone Sep 17, 2021
kylecarbs added a commit to kylecarbs/terraform-exec that referenced this issue Jan 29, 2022
@kylecarbs kylecarbs linked a pull request Jan 29, 2022 that will close this issue
@till
Copy link

till commented Feb 16, 2022

As a workaround:

        ctx := context.Background()
        outfile := "./mystate.state"
	tfexec.Plan(context, tfexec.Out(outfile))

	tfjson, _ := txexec.ShowPlanFile(context, outfile)

	b, _ := json.Marshal(tfjson)

	jsonOutfile := "./mystate.json"
	os.WriteFile(jsonOutfile, b, 0666)

rstandt pushed a commit to rstandt/terraform-exec that referenced this issue Jun 21, 2022
rstandt pushed a commit to rstandt/terraform-exec that referenced this issue Jun 21, 2022
rstandt pushed a commit to nefeli/terraform-exec that referenced this issue Jun 23, 2022
rstandt pushed a commit to nefeli/terraform-exec that referenced this issue Jun 24, 2022
@bendbennett
Copy link
Contributor

We have a use case for being able to stream JSON with the -json flag in Ability to test whether warnings are raised during test steps.

The intention is to modify the acceptance testing framework so that the -json flag can be used with terraform-exec to allow parsing of the streamed JSON in order to be able to verify that warning diagnostics are being emitted in specific tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants