Skip to content

Standardise logic for failing/warning when an error occurs during terraform version detection #451

@MatthewJohn

Description

@MatthewJohn

Is your feature request related to a problem? Please describe.

There are two use-cases when running tfswitch:

  • As a local user, I wish to run tfswitch. If tfswitch runs into a problem (i.e. it cannot parse my Terraform or it thinks there's an issue with a terragrunt config file), I would like it to show a warning and continue as normal (perhaps I specified the version as an arg, or have the version defined elsewhere).
  • As a CI/CD execution server, if I am expected to parse Terraform and obtain a version, if the terraform cannot be parsed, I do not wish to begin an endless loop of waiting for user input (because there won't ever be any)

Describe the solution you'd like

As suggested in the thread on/after #429 (comment), we could/should detect for a valid TTY and act accordingly. If there is no TTY, then we should fail when these errors occur, otherwise, we should continue to ask the user for input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRefactor existing code for better performance and quality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions