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

lookup_key options should support interpolation #96

Open
raffraffraff opened this issue Jul 18, 2023 · 0 comments
Open

lookup_key options should support interpolation #96

raffraffraff opened this issue Jul 18, 2023 · 0 comments

Comments

@raffraffraff
Copy link

I created a an AWS SSM Parameter Store plugin. It works, so I can write secrets to the parameter store and reference them from Hiera. An example hiera.yaml configuration that uses the plugin looks like this:

---
version: 5

defaults:
  plugindir: ./plugins
  datadir: ./data
  data_hash: yaml_data

hierarchy:
  - name: region
    path: region/%{region}.yaml

  - name: environment
    path: environment/%{environment}.yaml

  - name: common
    glob: defaults/*.yaml

  - name: secrets
    lookup_key: "aws_ssm_parameter"
    options:
      aws_profile_name: production.AdministratorAccess
      aws_region: "us-west-1"

What I had hoped to do was to use interpolation of %{environment} and %{region} in the options section, like this:

  - name: secrets
    lookup_key: "aws_ssm_parameter"
    options:
      aws_profile_name: "%{environment}.AdministratorAccess"
      aws_region: "%{region}"

This would enable Hiera to seamlessly switch between AWS accounts and regions based on these "facts" (or in the case of the Terraform Hiera provider, based on provider scope). Unfortunately, interpolation doesn't work for options so I must hard-code them. This forces me to store all parameters within a single AWS account and region.

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

No branches or pull requests

1 participant