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

Fix secrets put-secret command #545

Merged
merged 2 commits into from
Jul 5, 2023
Merged

Fix secrets put-secret command #545

merged 2 commits into from
Jul 5, 2023

Conversation

pietern
Copy link
Contributor

@pietern pietern commented Jul 5, 2023

Changes

Two issues with this command:

  • The command line arguments for the secret value were ignored
  • If the secret value was piped through stdin, it would still prompt

The second issue prevented users from using multi-line strings because the prompt reads until end-of-line.

This change adds testing infrastructure for:

  • Setting up a workspace focused test (common between many tests)
  • Running a snippet of Python through the command execution API

Porting more integration tests to use this infrastructure will be done in later commits.

Tests

New integration test passes.

The interactive path cannot be integration tested just yet.

Two issues with this command:
* The command line arguments for the secret value were ignored
* If the secret value was piped through stdin, it would still prompt

The second issue prevented users from using multi-line strings
because the prompt reads until end-of-line.

This change adds testing infrastructure for:
* Setting up a workspace focused test (common between many tests)
* Running a snippet of Python through the command execution API

Porting more integration tests to use this infrastructure
will be done in later commits.
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm confused but I think we need to handle the string value case.

cmd/workspace/secrets/overrides.go Show resolved Hide resolved
cmd/workspace/secrets/overrides.go Outdated Show resolved Hide resolved
return err
}
putSecretReq.BytesValue = base64.StdEncoding.EncodeToString(bytes)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a final else case for stringValueChanged != nil?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When string-value flag is set, cobra reads the value directly into putSecretReq.StringValue on line 27

@andrewnester andrewnester requested a review from mgyucht July 5, 2023 11:28
@pietern pietern merged commit db6313e into main Jul 5, 2023
@pietern pietern deleted the secrets-put branch July 5, 2023 15:30
@pietern pietern mentioned this pull request Jul 7, 2023
pietern added a commit that referenced this pull request Jul 10, 2023
## Changes

CLI:
* Fix secrets put-secret command
([#545](#545)).
* Fixed ignoring required positional parameters when --json flag is
provided ([#535](#535)).
* Update cp help message to not require file scheme
([#554](#554)).

Bundles:
* Fix: bundle destroy fails when bundle.tf.json file is deleted
([#519](#519)).
* Fixed error reporting when included invalid files in include section
([#543](#543)).
* Make top level workspace optional in JSON schema
([#562](#562)).
* Propagate TF_CLI_CONFIG_FILE env variable
([#555](#555)).
* Update Terraform provider schema structs
([#563](#563)).
* Update inline JSON schema documentation
([#557](#557)).

Dependencies:
* Bump Go SDK to v0.12.0
([#540](#540)).
* Bump github.com/hashicorp/terraform-json from 0.17.0 to 0.17.1
([#541](#541)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants