Skip to content

Add new feature: expand_env_vars #8

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

Merged
merged 2 commits into from
Feb 1, 2022
Merged

Add new feature: expand_env_vars #8

merged 2 commits into from
Feb 1, 2022

Conversation

oulman
Copy link
Owner

@oulman oulman commented Feb 1, 2022

This PR adds support for expand_env_vars which will evaluate/expand environment variables passed to extra_env_vars in generic ad/kv2 secrets.

Example:

kv_secret "consul" {
    path = "services/terraform/consul_backend"
    target_provider = "generic"
    expand_env_vars = true
    attribute_map = {
        "CONSUL_HTTP_TOKEN" = "secretid"
    }
    extra_env_vars = {
        "CONSUL_HTTP_ADDR" = "consul.service.dc1.consul:8501"
        "CONSUL_CACERT" = "$HOME/consul-ca-cert.pem"
        "CONSUL_CLIENT_CERT" = "$HOME/consul-cli-cert.pem"
        "CONSUL_CLIENT_KEY" = "$HOME/consul-cli-key.pem"
        "CONSUL_HTTP_SSL" = "true"
    }
}

Produces:

CONSUL_HTTP_TOKEN=<SNIP>
CONSUL_CACERT=/Users/oulman/consul-ca-cert.pem
CONSUL_CLIENT_CERT=/Users/oulman/consul-cli-cert.pem
CONSUL_CLIENT_KEY=/Users/oulman/consul-cli-key.pem
CONSUL_HTTP_ADDR=consul.service.dc1.consul.server.ufl.edu:8501
CONSUL_HTTP_SSL=true
```

@oulman oulman merged commit 782e4b1 into main Feb 1, 2022
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.

1 participant