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

Handle environment variables more dynamically #152

Closed
tayzlor opened this issue May 8, 2015 · 2 comments
Closed

Handle environment variables more dynamically #152

tayzlor opened this issue May 8, 2015 · 2 comments
Assignees
Milestone

Comments

@tayzlor
Copy link
Member

tayzlor commented May 8, 2015

Problem

Every time someone wants to override something in the bootstrap scripts this involves placing the environment variable in config-default.sh and modifying --extra-vars for Ansible.
We have a similar issue for terraform where we need to modify util.sh to add -var ... on to the terraform plan.
This is not really scalable.

Proposal

Part of the solution is to move to using terraform environment variables (introduced in terraform 0.5). See #148

The other idea is to handle any environment variables by doing something like the following -

  • namespace all environment variables APOLLO_
  • on bootstrap loop all APOLLO_ env variables and build up --extra-vars from those

e.g.

APOLLO_CONSUL_DC=eu-west-1 would become --extra-vars "consul_dc=eu-west-1"

This means when we add new features we do not need to surface any extra code in the bootstrap scripts

@tayzlor tayzlor added this to the 0.2 milestone May 8, 2015
@enxebre enxebre self-assigned this May 9, 2015
@enxebre
Copy link
Contributor

enxebre commented May 9, 2015

I like how we solve this in #138 for ansible. I would keep that approach (even if we split the PR )

For terraform even if we do the same approach and we allow to override via "APOLLO_", then "TF_VAR_name" will still be avalable once we move to 0.5.0 so they are compatible.

If we follow "APOLLO_" approach we need do differentiate some how between ansible and terraform otherwise we could end up with variables overlapping between the tools. So we would nee to do something like "APOLLO_TF" which makes me think why dont we just use "TF_VAR_name". So cant see a real benefit for using custom approach for terraform right now appart from cross tool project consistency. I think terraform question will be answered itself once the apollo plugin concept for terraform becomes more clear (see #140) so then we can line up with ansible related plugins.

@tayzlor
Copy link
Member Author

tayzlor commented May 11, 2015

for terraform - I would agree - lets just use TF_VAR_ - no point adding an additional layer here that does nothing. Let's just bump the minimum version as part of that PR - we could additionally put a check in verify-prereqs to check we are on at least 0.5.0 of terraform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants