Feat/add open tofu support - #5
Merged
Merged
Conversation
Introduced the OpenTofu package, which includes methods for installing the OpenTofu binary across different platforms (macOS, Linux, Windows) and orchestrating commands against IaC stack directories. Added comprehensive tests for installation detection methods and command execution, ensuring robust functionality and user experience.
Introduced the Tofu command, enabling users to install the OpenTofu binary and orchestrate Infrastructure as Code (IaC) stacks. The command includes subcommands for installation, version checking, and applying stack changes, enhancing the CLI's functionality for managing OpenTofu operations.
Added the Tofu command to the CLI under the "infra" category, enhancing the command set for managing OpenTofu operations. This integration supports improved user interaction with the Tofu functionalities.
…ture category Added the Tofu command to the architecture documentation, reflecting its role in managing OpenTofu installations and orchestration within the infrastructure category. This update enhances clarity on the command structure and available functionalities.
Updated the error message in the Tofu installation detection method to use lowercase for "homebrew," ensuring consistency and clarity in user feedback when Homebrew is not found on macOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
lab tofuunder theinfracommand group: install the OpenTofu binary via OS-native methods, then orchestratetofuagainst IaC stack directories.Install (
lab tofu install/version)internal/platformand picks a method:brew install|upgrade opentofuinstall-opentofu.sh --install-method deb--install-method rpmsnap install --classic opentofuwinget install OpenTofu.OpenTofu--dry-run(prints planned method + commands) and--upgradeOrchestration (
init/validate/plan/apply/fmt)tofu -chdir=<stack> …viainternal/execapplyrequires--yesfor-auto-approve(default is interactive)TF_VAR_*, passwords) are intended to come fromop run/ env injection — not from files on diskhomelab.root/hq-infrais left as a TODODocs / wiring
internal/tofuinternal/cli/commands/tofu.go, registered inroot.go(infra)docs/architecture.mdupdated (package table + command group)Test plan
make fmt && make vet && make lint && make buildgo test ./...(ormake test/ CI with-race)lab tofu install --dry-runshows correct method for this host (debon Ubuntu/apt)lab tofu installthenlab tofu versionlab tofu plan <stack-path> --dry-runprints plannedtofu -chdir=… planlab tofu apply <stack-path>without--yesdoes not pass-auto-approvelab tofu apply <stack-path> --yespasses-auto-approve