question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] 'runway tfenv install' broken

See original GitHub issue

Bug Description

Hello,

This started happening yesterday Apr 13, 2022

We’ve tried all sort of combinations of runway/terraform/python versions and cannot seem to make this work anymore.

This is affect our CI/CD pipeline which can no longer install the version of terraform specified in the runway.yaml file because runway, i believe, is using runway tfenv to install the desired version of terraform

Any help would be greatly appreciated. Until then i’ll be creating my own “wrapper” to install the desired versions of terraform myself into the directory runway is looking for $HOME/.tfenv/versions

Thanks!


devops/tfetest|~/repos/innovyze/devops-terraform
😄-bash-⌲ runway tfenv install 1.0.0
Traceback (most recent call last):
  File "/Users/patrick.raco/.local/bin/runway", line 8, in <module>
    sys.exit(cli())
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/runway/_cli/main.py", line 33, in invoke
    return super().invoke(ctx)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/runway/_cli/commands/_tfenv/_install.py", line 31, in install
    "terraform path: %s", TFEnvManager().install(version_requested=version)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/runway/env_mgr/tfenv.py", line 348, in install
    if not self.version:
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/backports/cached_property/__init__.py", line 80, in __get__
    val = self.func(instance)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/runway/env_mgr/tfenv.py", line 276, in version
    for i in get_available_tf_versions(include_prerelease_versions)
  File "/Users/patrick.raco/.local/lib/python3.7/site-packages/runway/env_mgr/tfenv.py", line 118, in get_available_tf_versions
    reverse=True,
  File "/Users/patrick.raco/.pyenv/versions/3.7.12/lib/python3.7/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/Users/patrick.raco/.pyenv/versions/3.7.12/lib/python3.7/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'```

### Expected Behavior

1. run: `runway tfenv install VERSION`
2. expect specified terraform version to be installed


### Steps To Reproduce

1. install `runway`: `pip install runway [--user]`
2. make sure desired version of terraform is not installed with: `runway tfenv list`
3. try to install it: `runway tfenv install --version`

### Runway version

- 1.18.1
- 1.18.3
- 2.6.1

### Installation Type

pypi (pip, pipenv, poetry, etc)

### OS / Environment

- macos
- linux

### Anything else?

- seems to happen if/when the desired version of terraform is NOT installed
- Did notice these diffs in the installed python packages between a successful and failed run:

![image](https://user-images.githubusercontent.com/3203156/163601117-349be257-6cfc-4f1b-8b97-82237ed6bc91.png)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ITProKylecommented, Apr 19, 2022

This is straying from the topic of this issue but @pataraco the issue you are referring to is not that YAML anchors are not supported its that invalid fields are no longer supported in the config file (e.g. air if not a valid field in a CFNgin or runway config file). All you need to do is define your anchors under a supported field.

Example:

deployments:
  - name: Core Infrastructure (Amazon VPC/Networking/Guardduty)
    modules:
      - path: terraform/configs/networking
        tags: [core, networking]
    module_options: &common_terraform_config
      terraform_version: 1.1.3
      terraform_backend_config:
        bucket: innovyze-${env DEPLOY_ENVIRONMENT}-${env AWS_REGION}-terraform-states
        dynamodb_table: innovyze-${env DEPLOY_ENVIRONMENT}-terraform-locks
        workspace_key_prefix: terraform-state-files  # default: 'env:'
        region: ${env AWS_REGION}
  - modules:
      - ...
    module_options:
      <<: *common_terraform_config
1reaction
pataracocommented, Apr 15, 2022

@sagargulabani as a workaround, i wrote something to install the required versions of terraform into the directory ($HOME/.tfenv/versions) that runway checks if it needs to install them itself using runway tfenv so it will be happy and just do the planning/deploying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manual installation broke. tfenv 2.2.2-82-g82fe3ce · Issue #284
Everything worked fine on Friday, but now it doesn't tfenv 2.2.2-82-g82fe3ce How to reproduce: docker run -it --rm ...
Read more >
Release 1.18.3 Onica Group - runway Documentation
runway tfenv install [OPTIONS] [<version>]. Options. --debug ... The path is broken down into the following attributes:.
Read more >
@onica/runway: Versions | Openbase
fix broken url in error when registering invalid CFNgin lookups @ITProKyle (#1295) ... cli: add tfenv list command @ITProKyle (#777); cli: add kbenv...
Read more >
How to manage multiple versions of Terragrunt and Terraform ...
Here is what this post will cover: Locking down compatible Terraform versions in your modules; Using tgswitch and tfenv to install multiple ...
Read more >
Difference between tfenv custom image build compare with ...
Difference between tfenv custom image build compare with standard hashicorp image ... and we are getting an error while installing software, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found