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

Is there an example of obscuring sensitive values in Atlantis workflow? #471

Closed
ryuheechul opened this issue Feb 12, 2019 · 2 comments
Closed
Labels
question Further information is requested

Comments

@ryuheechul
Copy link

ryuheechul commented Feb 12, 2019

I'm fairly new to terraform and very new to Atlantis, so please bare with me if I may ask about obvious things to experienced users.

I've just done test drive So I grasped how Atlantis work and willing to introduce this to our workflow.

by the way the test drive exprience was a hell of a way to demo! 👏

And I understand that in order to plan and apply I need to push the .tf/.tfvars and whatever necessary files into a repo and make a PR to work further.

And I just asked myself "How can I let Atlantis know about sensitive data via Terraform variables without committing the actual (text) data (either reading from somewhere or obscure the data) since I don't want to store that sensitive data into a git(hub) repo which many random team members can access it anytime?"

So I've looked at guide and docs and but I wasn't able to find any similar stuff there yet.

One thing I assumed it should work is injecting those data as ENV VARS when I spin up Atlantis. For example, TF_VAR_my_secret.

And since I still don't know what would considered as a best practice to achieve this and I'm also curious how other folks deal with the similar issues, wanting to hear your opinions!

@lkysow
Copy link
Member

lkysow commented Feb 15, 2019

Hi Heechul,
Yes this is a very good question.

  1. If you're talking about secrets like AWS (or other cloud) credentials, people will set these as environment variables where they're running the atlantis server.

  2. For other secrets that might be needed on a per-project basis, there's not as good an answer. Some people are storing these secrets in HashiCorp vault and then using the vault provider to populate a data variable:

    provider "vault" {
     ...
    }
    data "vault_generic_secret" "secret" {
      path = "path"
    }
    provider "vsphere" {
      password       = "${data.vault_generic_secret.secret["password"]}"
    }

    You could do the same thing by storing the secret in AWS's secret manager and then using the aws_secretsmanager_secret_version data source (https://www.terraform.io/docs/providers/aws/d/secretsmanager_secret_version.html).

  3. You could use a custom run step to retrieve a secret from somewhere, set it as a TF_var environment variable and then execute the terraform plan:

    version: 2
    projects:
    - dir: .
      workflow: custom
    workflows:
      custom:
        plan:
          steps:
          - init
          - run: source ./my-script-to-retrieve-secrets.sh && terraform plan -input=false -refresh -no-color -out $PLANFILE
    

Let me know if that's helpful.

by the way the test drive experience was a hell of a way to demo! 👏

Thanks so much! Great to hear it 😃

@lkysow lkysow added the waiting-on-response Waiting for a response from the user label Feb 15, 2019
@ryuheechul
Copy link
Author

Thanks! Your answer is pretty helpful!

I will try what you suggested and will let you know if I encounter any problems.

@lkysow lkysow added question Further information is requested and removed waiting-on-response Waiting for a response from the user labels Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants