lundi 27 juillet 2015

Vagrant source value from environmental variable

I am setting up a vagrant deployment with aws as the backend. I would like to source values from the shell. For instance

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"

  config.vm.provider :aws do |aws, override|
    aws.access_key_id = "YOUR KEY"
    aws.secret_access_key = "YOUR SECRET KEY"
    aws.session_token = "SESSION TOKEN"
    aws.keypair_name = "KEYPAIR NAME"

    aws.ami = "ami-7747d01e"

    override.ssh.username = "ubuntu"
    override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
  end
end

I would like to populate the aws.{access_key_id,secret_access_key,etc} values from local environmental variables in BASH (e.g. $access_key_id, $secret_access_key, etc).

Is this possible to do directly in ruby or is there a specific vagrant DSL technique that allows for this?




Aucun commentaire:

Enregistrer un commentaire