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

Support setup-terraform action (with the default wrapper) #1020

Open
ansgarm opened this issue Sep 15, 2021 · 0 comments
Open

Support setup-terraform action (with the default wrapper) #1020

ansgarm opened this issue Sep 15, 2021 · 0 comments
Labels
cdktf-cli enhancement New feature or request good first issue Good for newcomers priority/backlog Low priority (though possibly still important). Unlikely to be worked on within the next 6 months. tech-debt

Comments

@ansgarm
Copy link
Member

ansgarm commented Sep 15, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The setup-terraform Github Action by default wraps the Terraform CLI in a wrapper which alters its output. This produces different errors, e.g. get fails and planning / deploying might also fail (haven't checked yet, but as of TF 1.0 we also parse some JSON there).

References

Workaround (until this is closed)

Disable the wrapper:

- uses: hashicorp/setup-terraform@v1
  with:
    terraform_version: 0.14
    terraform_wrapper: false # <--

Related code locations

The following locations might need to be touched to support the prefixes to the Terraform output on stdout.
For fixing the get command:

providerSchema = JSON.parse(
await exec(terraformBinaryName, ["providers", "schema", "-json"], {
cwd: outdir,
})
) as ProviderSchema;

For parsing the plan:
const jsonPlan = await exec(
terraformBinaryName,
["show", "-json", planFile],
{ cwd: this.workdir, env: process.env }
);
return new TerraformCliPlan(planFile, JSON.parse(jsonPlan));

For parsing the outputs:
const output = await exec(
terraformBinaryName,
["output", "-json", ...this.stateFileOption],
{ cwd: this.workdir, env: process.env }
);
return JSON.parse(output);

The progress updates while deploying / destroying are interpreted line by line. Wrapping this would probably be the easiest way to hook in and remove the prefix from each line:


@ansgarm ansgarm added enhancement New feature or request good first issue Good for newcomers cdktf-cli needs-priority Issue has not yet been prioritized; this will prompt team review labels Sep 15, 2021
@danieldreier danieldreier added priority/backlog Low priority (though possibly still important). Unlikely to be worked on within the next 6 months. and removed needs-priority Issue has not yet been prioritized; this will prompt team review labels Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cdktf-cli enhancement New feature or request good first issue Good for newcomers priority/backlog Low priority (though possibly still important). Unlikely to be worked on within the next 6 months. tech-debt
Projects
None yet
Development

No branches or pull requests

3 participants