mitchellh/vagrant-aws

aws.region is being ignored

memoryleak opened this issue · 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

running into this same problem running vagrant on ubuntu 16.04

Vagrant (2.0.4)
vagrant-aws (0.7.2)

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

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?

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

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