terragrunt conflicts with tfenv

Created on 1 Oct 2018  路  4Comments  路  Source: gruntwork-io/terragrunt

Hello,

OS macOS 10.14
trying to install terragrunt

$ brew install terragrunt

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

==> Installing dependencies for terragrunt: terraform
==> Installing terragrunt dependency: terraform
Error: Cannot install terraform because conflicting formulae are installed.
tfenv: because tfenv symlinks terraform binaries

Please brew unlink tfenv before continuing.

Unlinking removes a formula's symlinks from /usr/local. You can
link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side-effects in the
resulting software.

So terragrunt won't install because of Tfenv exists.
Any help ?

enhancement help wanted

Most helpful comment

You can just skip dependencies when installing:

brew install --ignore-dependencies terragrunt

Or in a Brewfile (Homebrew Bundle):

brew "awscli"
brew "aws-okta"
brew "terraform_landscape"
brew "terragrunt", args: ["ignore-dependencies"]
brew "tfenv"

Then it can be installed via brew bundle.

But I'd also prefer terraform not to be a hard dependency. Though I couldn't find the source for the Homebrew config to propose a change.

All 4 comments

The Homebrew installer for Terragrunt is maintained by the community, so to be honest, I'm not sure what is the right fix for this. Suggestions and PRs are very welcome!

@MacFlurry I ran into this same issue and this was my workaround. I use tfenv to use the terraform version 0.11.7

Verify before

$ terraform --version
0.11.7

Workaround will unlink tfenv, install terragrunt which installs the latest version of terraform (which it depends on), and then we can relink tfenv to use the original 0.11.7 version

brew unlink tfenv && brew install terragrunt && brew link tfenv

Verify after

$ terraform --version
0.11.7

And according to terragrunt --help, it looks like it will default to use the terraform on PATH.

GLOBAL OPTIONS:
   ...
   terragrunt-tfpath                    Path to the Terraform binary. Default is terraform (on PATH).

You can just skip dependencies when installing:

brew install --ignore-dependencies terragrunt

Or in a Brewfile (Homebrew Bundle):

brew "awscli"
brew "aws-okta"
brew "terraform_landscape"
brew "terragrunt", args: ["ignore-dependencies"]
brew "tfenv"

Then it can be installed via brew bundle.

But I'd also prefer terraform not to be a hard dependency. Though I couldn't find the source for the Homebrew config to propose a change.

An issue with using a Brewfile with ignore-dependencies is that flag is ignored on upgrades, giving the same linking issues. Since homebrew core doesn't support options which would allow terraform install to be optional, I'm considering a PR to remove terraform as a dependency and adding info about installing terraform/tfenv in the caveats section. Curious what others, especially maintainers might think about this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zachwhaley picture zachwhaley  路  3Comments

GauntletWizard picture GauntletWizard  路  3Comments

lsc picture lsc  路  4Comments

jtai-omniex picture jtai-omniex  路  3Comments

antonbabenko picture antonbabenko  路  3Comments