vagrant-aws icon indicating copy to clipboard operation
vagrant-aws copied to clipboard

aws.region is being ignored

Open memoryleak opened this issue 6 years ago • 5 comments

Versions Vagrant 2.0.2 vagrant-aws (0.7.2)

Vagrantfile

config.vm.box = "dummy"
   config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
   config.vm.provider :aws do |aws, override|
   aws.keypair_name = "...."
   aws.ami = "ami-192a9460"
   aws.instance_type = "c5.large"
   aws.region = "eu-west-1"
   

   aws.security_groups = ["sg-....", "sg-...."]
   aws.subnet_id = "subnet-...."
   aws.iam_instance_profile_name = "EC2ReadOnly"

   override.ssh.username = "centos"
   override.ssh.private_key_path = "~/.ssh/id_rsa"
 end

Expected: AWS provider using eu-west-1 as region.

Actual: Region us-east-1 always used

memoryleak avatar Mar 05 '18 16:03 memoryleak

running into this same problem running vagrant on ubuntu 16.04

Vagrant (2.0.4) vagrant-aws (0.7.2)

sammerry avatar May 10 '18 21:05 sammerry

Same here - appears env variable AWS_DEFAULT_REGION can be used as a workaround in the interim.

HarryWeppner avatar May 25 '18 02:05 HarryWeppner

Same problem here, I would prefer to avoid overriding in environment variables because it is not easy to tell what the behavior will be. Shouldn't the config region option override the aws config file?

matttrach avatar Aug 30 '18 14:08 matttrach

Is this really still open? I couldn't do a multi-region deployment due to this same reason.

sanjeevgopal avatar May 13 '19 13:05 sanjeevgopal

It looks like the problem is if you don't specify an access key or secret key explicitly, the plugin will fetch them from your environment. When doing this, it unfortunately also seems to take the liberty of setting your region as well.

https://github.com/mitchellh/vagrant-aws/blob/master/lib/vagrant-aws/config.rb#L330

chrisgavin avatar Nov 08 '19 12:11 chrisgavin