chef [SOLVED]: Chef: Vault Hashicorp ruby gem

chef [SOLVED]: Chef: Vault Hashicorp ruby gem

Home Forums Automation Tools Chef Tutorials chef [SOLVED]: Chef: Vault Hashicorp ruby gem

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #201440

    Cloudy Point
    Keymaster

    QuestionQuestion

    I’m trying to use the vault gem on my chef recipe.

    I’m importing it on my `metadata.rb

    gem vault
    

    Then on my recipe default.rb

    Vault.configure do |config|
      config.address = "http://127.0.0.1:8200"
      config.token = "token"
    end
    
    secret = Vault.logical.read("secret/stripe")
    stripe_key = secret.data[:api_key]
    

    But an error raises:

    uninitialized constant #<Class:#<Chef::Recipe:0x00000000036346a8>>::Vault
    14>> Vault.configure do |config|
    

    What i’m missing?

    #201441

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    You will have to do require 'vault' on the top of your default.rb file. That way the Vault constant will be made available to your recipe.

    Source: https://stackoverflow.com/questions/46523835/chef-vault-hashicorp-ruby-gem
    Author: bitsapien
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.