-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Handling passwords #550
Comments
Hi Justin, do the answers here help? #471 |
I've got some additional questions on this, and perhaps the way I'm think about this, you can provide some best practices feedback: The way you mention in #471 would work:
.... For setting up a password before hand, but think of this from an end user's perspective with the scenario above, they'll have to set that password in vault prior to the TF run. Can you think of any type of scenario where a random string could be generated for username/pw, and be output into a vault wrapper, for people to pick up their credentials after the fact? Is that a thing that's possible? This might be more of a terraform question. |
Would something like this work for you?
I'm not 100% sure but I think the value of |
I've gotta set up the vault provider today, let me see if I can test this ^ out and see the result. As a feature request for the project, I think it would be a value add to publish things like this on how to handle secrets with different scenarios when using Atlantis/Terraform |
Absolutely, I've been meaning to add an FAQ section to the docs. |
Do you have any documentation on deploying the vault auth piece with your helm chart? since this is in a stateful set and the vault/k8s documentation is in a deployment, I would assume if anyone wants to use Atlantis and have secret management, the main way of deploying via helm charts would no longer work, as you now have to add in these vault side cars: https://learn.hashicorp.com/vault/identity-access-management/vault-agent-k8s |
Sorry I do not have documentation on this. As far as I know, you're the first user to be doing this. I agree it's getting into the weeds but I'm guessing the "average user" either use their cloud provider's secret store, or use kubernetes secrets to inject credentials, or injects a long-lived vault token so they don't need the sidecar. |
When I get this running, I'll make the statefulset generic and do a PR if you want to use it as an example |
Got it running, you can close out the issue. Let me know if you want an example of the helm deployment's statefulset + vault pieces to integrate |
@justinhauer It looks like either I may have missed some of the context around what you were trying to do here or that you pivoted to a modified solution (your mentions of helm have me confused). I would very much like more details and context around what you're doing here if you don't mind sharing. If this ticket is not the appropriate place to do so, you're welcome to message me on the Atlantis slack (@ tedward). |
Posting them here would be great! |
Sure, here's a recap:
That deployed successfully - but there was no documentation around Azure credential to use terraform with an Azure provider in your documentation, so I added in env-vars into a container image based off your container image. With this, I was able to deploy resources to Azure.
This can be figured out in the .tf file by using the terraform vault provider docs to craft your module/.tf file.
|
Forgot @lkysow that the docs for the vault integration are here: https://learn.hashicorp.com/vault/identity-access-management/vault-agent-k8s |
Also wanted to leave a minor follow-up to my previous comment. In digging in to this for something else I was working on, it does look like |
Right, you need to send that random string somewhere though or you wouldn't know what it is :) |
The thread is closed but I want to add one more option here. Since we are talking about running Atlantis on k8s, the secret data can be taken from k8s secret.
[kubernetes_secret data source](https://www.terraform.io/docs/providers/kubernetes/d/secret.html_ |
I'm struggling with a similar issue. I want to use Atlantis to provision a Test and Production instance of Vault. I've used My server-side repo config looks like this: repos:
- id: /.*/
apply_requirements: [approved,mergeable]
allowed_overrides: [workflow]
allow_custom_workflows: false
workflows:
test:
plan:
steps:
- init:
extra_args: [-backend-config=vars/test.backend.tfvars]
- plan:
extra_args: [-var-file=vars/test.tfvars]
apply:
steps:
- apply:
extra_args: [-var-file=vars/test.tfvars]
production:
plan:
steps:
- init:
extra_args: [-backend-config=vars/production.backend.tfvars]
- plan:
extra_args: [-var-file=vars/production.tfvars]
apply:
steps:
- apply:
extra_args: [-var-file=vars/production.tfvars] And my Terraform project version: 3
projects:
- name: vault-test
dir: .
workflow: test
workspace: test
terraform_version: v0.13.5
- name: vault-production
dir: .
workflow: production
workspace: production I'm also wanting to use a Consul-Test backend for Vault-Test state, and a Consul-Prod backend for Vault-Prod state. When I submit a PR, a plan is generated in the test workspace using the test workflow which swaps out tfvars. And similar for production. I would then have to run separate apply commands in GitHub with the correct What I can't figure out is how to toggle the backend and Vault test vs production credentials. Is there a clean way to do this? Another thought was to have two Atlantis instances and set up a webhook for each so that when a PR is submitted Atlantis-test uses the Consul-Test backend and has the Vault-Test environment variables set (or AppRole for auth). In a nutshell, I have a single Terraform config project and I want to use Atlantis to apply that configuration on a Vault-Test instance and have it's state stored in a Consul-Test backend. And if that looks good, also have Atlantis apply the configuration on a Vault-Prod instance with state in a Consul-Prod backend. And pass the Vault/Consul credentials to Atlantis securely. Anyone have any suggestions? Thanks PS. Here's a screenshot showing how it ran the plan. (Note, the backend is hard-coded to Consul-Test and a single Vault instance. Can't figure out how pass credentials to the backend and Vault instances securely when there are multiple backends and Vault instances. I don't want tfvars in the project.) |
How are people handling passwords being sent into the .tf file with Atlantis? Example: I want to create a database in Azure, and in the .tf file for this I need to set the username and password for the database - I obviously don't want this in Git history. What way should this be handled? Perhaps a Vault integration, which could pull the values from vault into Terraform at runtime?
The text was updated successfully, but these errors were encountered: