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

tfexec: add InitJSON #478

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

bschaatsbergen
Copy link
Member

@bschaatsbergen bschaatsbergen commented Oct 6, 2024

Fixes #442

  • refactor tfexec/init.go to facilitate (split some code into distinct functions) to support the new InitJSON function, similar to ApplyJSON and PlanJSON.
  • Added InitJSON functions.
  • Added cmd and E2E tests.

refactors `tfexec/init.go` by splitting the init functions into distinct functions to facilitate the support of the new InitJSON function.

Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
The `InitJSON` and `initJSONCmd` functions append the `-json` argument to instruct the init command to write machine-readable JSON to the supplied `io.Writer`.

Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
@bschaatsbergen bschaatsbergen marked this pull request as ready for review October 6, 2024 16:22
@bschaatsbergen bschaatsbergen requested review from a team as code owners October 6, 2024 16:22
…de positional arguments.

Since the optional positional directory argument must follow all flags, as flags precede positional arguments, we append it to the args list only after all flags have been added.

Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
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.

Support terraform init JSON output (coming soon)
1 participant