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

Request: Support Compatibility with OpenTofu + tenv #140

Closed
RDhar opened this issue Sep 25, 2023 · 5 comments · Fixed by #153 or #193
Closed

Request: Support Compatibility with OpenTofu + tenv #140

RDhar opened this issue Sep 25, 2023 · 5 comments · Fixed by #153 or #193

Comments

@RDhar
Copy link
Member

RDhar commented Sep 25, 2023

Is your feature request related to a problem

N/a.

Describe the solution you'd like

With the launch of OpenTofu fork, I'd like to support OpenTofu as a first-class IaC provisioning tool, just like Hashicorp's Terraform.

Describe alternatives you've considered

While we await (pre-)releases to become available, a serviceable workaround has been shared by @zimeg (from Slack) to download, install and initialize OpenTofu CLI in 3 GitHub Actions steps.

- name: Download the tofu source
  uses: actions/checkout@v4
  with:
    repository: opentofu/opentofu
    path: opentofu

- name: Install tofu tooling
  uses: actions/setup-go@v4
  with:
    go-version-file: opentofu/go.mod
    cache-dependency-path: opentofu/go.sum

- name: Prepare the tofu command
  working-directory: opentofu
  run: |
    go build -ldflags "-w -s -X 'github.com/opentofu/opentofu/version.dev=no'" -o bin/tofu .
    echo $(pwd)/bin >> $GITHUB_PATH

Additional context

Issue opentofu/opentofu#556 has been raised in order to deliver a more "drop-in replacement"-able equivalent to hashicorp/setup-terraform.

@RDhar
Copy link
Member Author

RDhar commented Oct 29, 2023

Over the last month, OpenTofu has published opentofu/setup-opentofu to lower the barrier to entry for implementing tofu as part of the CI/CD pipelines.

While we deliver first-class support with OpenTofu, we must ensure backwards-compatibility with Hashicorp Terraform. As result, the decision for choosing between must be easily user-configurable.

@kvendingoldo
Copy link

btw. you can also integrate tenv that support Terraform as well as OpenTofu (and Terragrunt :) ) in one tool. It allow you to simplify version management.

@RDhar
Copy link
Member Author

RDhar commented Apr 3, 2024

Good call, @kvendingoldo! Despite using tenv locally, I hadn't considered adding it here before and it's well worth implementing.

Also worth mentioning that, as of the latest v10 release, this Action no longer ships with setup-opentofu or setup-terraform, in order to reduce dependencies and enable the user to supply their own configuration directly.

As a result, I've opened a PR to add a functional demo using tenv in a scenario which tests both terraform and tofu execution simultaneously. Aside, also opened a wee request to allow explicit/unambiguous human-friendly aliases for tenv tool names.

Only remaining issue is PR output comment. More specifically, the aforementioned setup-opentofu/terraform Actions come with their own wrapper script which exposes stdout, stderr, and exitcode automatically by default. These outputs are leveraged when creating PR comments like this. Is there a similar-ish equivalent for sourcing tenv outputs?

@RDhar RDhar reopened this Apr 3, 2024
@kvendingoldo
Copy link

I think that we can easily implement sourcing tenv outputs. Can you open an issue for that, pls? We'll take a look as soon as it would be possible for the team.

@RDhar
Copy link
Member Author

RDhar commented Apr 3, 2024

Sure, @kvendingoldo, I've just gone ahead and opened that request -- though I worry it might be "deceptively simple".

The setup-opentofu/terraform Actions are... Actions. So it's easier for them to supply a wrapper script with custom outputs which are particularly suited for use in CI automation.

I'd be just as happy with workaround suggestions using bash/shell within CI context as well.

@RDhar RDhar changed the title Request: Support Compatibility with OpenTofu Request: Support Compatibility with OpenTofu + tenv Apr 3, 2024
@RDhar RDhar closed this as completed in #193 Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants