Skip to content

Update path interpolate function to allow root#118

Merged
yakatz merged 1 commit into
voxpupuli:masterfrom
bdeferme:slash_interpolate
Feb 22, 2026
Merged

Update path interpolate function to allow root#118
yakatz merged 1 commit into
voxpupuli:masterfrom
bdeferme:slash_interpolate

Conversation

@bdeferme

@bdeferme bdeferme commented Feb 9, 2026

Copy link
Copy Markdown

Pull Request (PR) description

The issue with the current interpolate function: it silently drops the root path (/). This happens because split('/') on / returns an empty array ([]), which is then skipped due to the unless segments.empty? condition.

For our use case, the root path (/) is a valid and meaningful entry. It allows us to use explicit lookups in hieradata, which brings several benefits:

  • Reduced traversal through the vault tree.
  • Improved readability of configurations.
  • More flexibility in how we structure and migrate secrets.

For example, with a path list like:

  • /
  • nodes/%{facts.networking.fqdn}
  • environments/%{trusted.extensions.pp_role}
  • common

We can resolve secrets like this in common.yaml:

profile::cool::access_key: "%{lookup('provider/s3/access-keys/fancy-prd.key')}"

This would map to the vault path /provider/s3/access-keys/fancy-prd.key.

We’re migrating all our secrets to explicit lookups, and this path list allows us to do it gradually, rather than in a big-bang migration. However, the current implementation makes this difficult.

@yakatz yakatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good - please fix the rubocop warnings.

@bdeferme bdeferme requested a review from yakatz February 16, 2026 15:02
@yakatz yakatz merged commit 97e9c81 into voxpupuli:master Feb 22, 2026
4 checks passed
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.

2 participants