Vagrant.configure("2") do |config|
  rhel_vm_name = "#{ENV['USER']}-rhel"
  windows_vm_name = "#{ENV['USER']}-windows"
  if ENV['USER'] =~ /^(.*)[_-](\d+)$/
    rhel_vm_name = "#{$1}-rhel-#{$2}"
    windows_vm_name = "#{$1}-windows-#{$2}"
  end
  config.openshift.autoconfigure_aws = true

  config.vm.provider "aws" do |aws|
    aws.instance_type = "m4.large"
    aws.subnet_id = "subnet-cf57c596"
  end

  config.vm.define "rhel" do |rhel|
    rhel.vm.provider "aws" do |aws|
      aws.tags = {"Name" => rhel_vm_name}
      aws.ami = "rhel7:inst"
    end
    rhel.vm.provision "configure-docker-server-linux"
  end

  config.vm.define "windows" do |windows|
    windows.vm.provider "aws" do |aws|
      aws.tags = {"Name" => windows_vm_name}
      aws.ami = "windows2012r2:deps"
    end
    windows.vm.provision "configure-docker-client-windows"
  end
end
