Last active
May 7, 2020 16:59
-
-
Save logicminds/20ed2cb74648d9b84f714955feec3095 to your computer and use it in GitHub Desktop.
Puppet Sensitive datatype wrapped in a hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class test(Hash $config){ | |
file{'/tmp/test123.txt': | |
ensure => file, | |
content => Sensitive($config.to_yaml), | |
} | |
} | |
$jwt_token = Sensitive.new('doublesecret') | |
$config = { | |
general => { | |
loglevel => 'INFO' | |
}, | |
jwt_token => { | |
secret => $jwt_token.unwrap, | |
validity => '7200', | |
} | |
} | |
class{'test': config => $config } |
If I don't use unwrap() function the file displays the raw ruby object which is to be expected base we are wrapping the Sensitive as a Sensitive.
---
general:
loglevel: INFO
jwt_token:
secret: !ruby/object:Puppet::Pops::Types::PSensitiveType::Sensitive
value: doublesecret
validity: '7200'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notice on line 14 I use the unwrap function, which turns the jwt_token into clear text.
This results in