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

Bug | failure when running apply with parameters with space #159

Closed
juanmatias opened this issue Jan 20, 2023 · 2 comments · Fixed by #260
Closed

Bug | failure when running apply with parameters with space #159

juanmatias opened this issue Jan 20, 2023 · 2 comments · Fixed by #260
Assignees
Labels
bug Something isn't working patch

Comments

@juanmatias
Copy link
Contributor

juanmatias commented Jan 20, 2023

Describe the Bug

The Leverage CLI will fail due to a lack of variable values when apply is passed with a parameter with space.
E.g.

leverage tf apply -target kubernetes_manifest.irfq

instead of

leverage tf apply -target=kubernetes_manifest.irfq

In this loop:

for arg in args:

it is checked a value with no parameter is passed. When this happens there is the chance of user running apply on an already created plan, e.g.:

leverage tf apply thesecretplan

In this case, all the default parameters have to be removed from the command since Terraform does not allow passing -var or -var-file when applying a saved plan.

Because the way the loop has made, when passing a parameter without the "=" sign, it understands as if it were a plan.

So a list of parameters and flags has to be made in order to be able to check all the possibilities, e.g.:

  • -target=kubernetes_manifest.irfq
  • -target kubernetes_manifest.irfq
  • -no-color

etc

Expected Behavior

It should accept both ways of setting command line parameters.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to a RefArch layer
  2. Run leverage tf apply -target kubernetes_manifest.irfq (change the resource name with one that exists in your layer)
  3. Hit Enter
  4. See error

Screenshots

$:~/.../apps-qa/us-east-1/k8s-eks/k8s-workloads$ leverage tf apply -target kubernetes_manifest.irfq
[15:27:40]   INFO       MFA: Found 1 profile/s
[15:27:40]   INFO       MFA: Attempting to get temporary credentials for profile arta-apps-qa-devops
MFA: Please type in your OTP: 999999
[15:28:09]   INFO       MFA: Credentials written succesfully!
Acquiring state lock. This may take a few moments...
var.accounts
  Accounts Email & Id

  Enter a value: 

It asks you for a value when it should not do this.

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: [e.g. Linux, OSX, WSL, etc]
  • Version [e.g. 10.15]

Additional Context

n/a

IMPORTANT

Add test cases for this scenario.

@juanmatias juanmatias added bug Something isn't working patch labels Jan 20, 2023
@exequielrafaela
Copy link
Member

@Franr looking forward to your feedback for this task. Thanks!

@angelofenoglio
Copy link
Contributor

Handled in #274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants