Module: VagrantPlugins::TerraformProvider::Util::MachineNames

Included in:
Action::CreateVM, Action::ReadState
Defined in:
lib/vagrant-terraform/util/machine_names.rb

Constant Summary collapse

DEFAULT_NAME =
'vagrant'.freeze

Class Method Summary collapse

Class Method Details

.machine_hostname(machine) ⇒ Object



9
10
11
# File 'lib/vagrant-terraform/util/machine_names.rb', line 9

def machine_hostname(machine)
  machine.config.vm.hostname || DEFAULT_NAME
end

.machine_vmname(machine) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/vagrant-terraform/util/machine_names.rb', line 13

def machine_vmname(machine)
  if machine.id.nil?
    machine.provider_config.vmname || machine_hostname(machine)
  else
    machine.id
  end
end