Skip to content

Instantly share code, notes, and snippets.

@jonasfj
Created January 28, 2014 21:34
Show Gist options
  • Save jonasfj/8676999 to your computer and use it in GitHub Desktop.
Save jonasfj/8676999 to your computer and use it in GitHub Desktop.
Carry AWS credentials into vagrantfile...
if ENV['AWS_ACCESS_KEY_ID'] == nil or ENV['AWS_SECRET_ACCESS_KEY'] == nil
raise Vagrant::Errors::VagrantError.new,
"This vagrantfile requires AWS credentials as environment variables!\n"
end
Vagrant.configure("2") do |config|
config.vm.box = "jonasfj-taskcluster-dev-0.0.0"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/20140126/saucy-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provision "shell", inline: <<-SCRIPT
echo 'export AWS_ACCESS_KEY_ID="#{ENV['AWS_ACCESS_KEY_ID']}";' >> /home/vagrant/.bashrc;
echo 'export AWS_SECRET_ACCESS_KEY="#{ENV['AWS_SECRET_ACCESS_KEY']}";' >> /home/vagrant/.bashrc;
SCRIPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment