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

moving secrets off var.tfvars file and to command line args #86

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

miyamotoh
Copy link
Contributor

@miyamotoh miyamotoh commented Sep 18, 2020

Saving sensitive data in a text file on disk is not a good practice. Moving them off to command line args with -var for the terraform apply command. Tested fine by building a 4.5 cluster in tor01. Open to different env vars naming and wording for the doc. Just let me know.

Signed-off-by: Hiro Miyamoto miyamotoh@us.ibm.com

@ltccci
Copy link
Contributor

ltccci commented Sep 18, 2020

Welcome @miyamotoh! It looks like this is your first PR to ocp-power-automation/ocp4-upi-powervs 🎉

@ltccci ltccci added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 18, 2020
@ltccci
Copy link
Contributor

ltccci commented Sep 18, 2020

Hi @miyamotoh. Thanks for your PR.

I'm waiting for a ocp-power-automation member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ltccci ltccci added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 18, 2020
@yussufsh
Copy link
Contributor

Good input.

FYI Terraform support passing variables directly from env.
eg: export TF_VAR_<variable_name>
https://www.terraform.io/docs/commands/environment-variables.html#tf_var_name

@miyamotoh
Copy link
Contributor Author

Do you want me to change this PR to go with TF_VAR_xxxxx (so we can keep the terraform apply cmd the same as before)? Let me know.

@@ -38,14 +38,20 @@ All further instructions assumes you are in the code directory eg. `ocp4-upi-pow

Update the [var.tfvars](../var.tfvars) based on your environment. Description of the variables are available in the following [link](./var.tfvars-doc.md).

For sensitive variables that should not be saved on disk, set these environment variables;
Copy link
Contributor

@bpradipt bpradipt Sep 19, 2020

Choose a reason for hiding this comment

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

How about rephrasing it to -
"You can use environment variables for sensitive data that should not be saved to disk"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

@@ -119,7 +120,7 @@ Please note that only OpenSSH formatted keys are supported. Refer to the followi
Create the SSH key-pair and keep it under the `data` directory

These set of variables specify the RHEL subscription details.
Update the variables with your subscription id and password.
They are here just to keep all Terraform variables in use in one place, and because they are secrets, you should not set your values and save it on disk. Instead, set environment variables `RHEL_SUBS_USERNAME` and `RHEL_SUBS_PASSWORD` and pass them to `terraform apply` command as shown in the [Quickstart guide](./quickstart.md).
Copy link
Contributor

Choose a reason for hiding this comment

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

""This is sensitive data and if you don't want to save it on disk, use environment variables and pass it to terraform apply command as shown in .."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, will be in the next push.

Signed-off-by: Hiro Miyamoto <miyamotoh@us.ibm.com>
Copy link
Contributor

@bpradipt bpradipt left a comment

Choose a reason for hiding this comment

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

/lgtm
Thanks @miyamotoh

@ltccci ltccci added the lgtm Indicates that a PR is ready to be merged. label Sep 23, 2020
@ltccci
Copy link
Contributor

ltccci commented Sep 23, 2020

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bpradipt, miyamotoh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ltccci ltccci added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2020
@ltccci ltccci merged commit bc9fb8a into ocp-power-automation:master Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants