Class: VagrantPlugins::TerraformProvider::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::TerraformProvider::Config
- Defined in:
- lib/vagrant-terraform/config.rb
Instance Attribute Summary collapse
-
#api_token_id ⇒ Object
Returns the value of attribute api_token_id.
-
#api_token_secret ⇒ Object
Returns the value of attribute api_token_secret.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#cpu_cores ⇒ Object
Returns the value of attribute cpu_cores.
-
#cpu_type ⇒ Object
Returns the value of attribute cpu_type.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#description ⇒ Object
Returns the value of attribute description.
-
#disk_size ⇒ Object
Returns the value of attribute disk_size.
-
#disks ⇒ Object
readonly
Returns the value of attribute disks.
-
#full_clone ⇒ Object
Returns the value of attribute full_clone.
-
#insecure ⇒ Object
Returns the value of attribute insecure.
-
#memory_size ⇒ Object
Returns the value of attribute memory_size.
-
#nameserver ⇒ Object
Returns the value of attribute nameserver.
-
#onboot ⇒ Object
Returns the value of attribute onboot.
-
#os_type ⇒ Object
Returns the value of attribute os_type.
-
#searchdomain ⇒ Object
Returns the value of attribute searchdomain.
-
#serial_port ⇒ Object
Returns the value of attribute serial_port.
-
#storage_domain ⇒ Object
Returns the value of attribute storage_domain.
-
#target_node ⇒ Object
Returns the value of attribute target_node.
-
#template ⇒ Object
Returns the value of attribute template.
-
#vga ⇒ Object
Returns the value of attribute vga.
-
#vmname ⇒ Object
Returns the value of attribute vmname.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vagrant-terraform/config.rb', line 31 def initialize @api_url = UNSET_VALUE @api_token_id = UNSET_VALUE @api_token_secret = UNSET_VALUE @vga = UNSET_VALUE @insecure = UNSET_VALUE @debug = UNSET_VALUE @vmname = UNSET_VALUE @template = UNSET_VALUE @disk_size = UNSET_VALUE @storage_domain = UNSET_VALUE @cpu_cores = UNSET_VALUE @cpu_type = UNSET_VALUE @memory_size = UNSET_VALUE @target_node = UNSET_VALUE @onboot = UNSET_VALUE @description = UNSET_VALUE @nameserver = UNSET_VALUE @searchdomain = UNSET_VALUE @os_type = UNSET_VALUE @full_clone = UNSET_VALUE @serial_port = UNSET_VALUE end |
Instance Attribute Details
#api_token_id ⇒ Object
Returns the value of attribute api_token_id.
10 11 12 |
# File 'lib/vagrant-terraform/config.rb', line 10 def api_token_id @api_token_id end |
#api_token_secret ⇒ Object
Returns the value of attribute api_token_secret.
11 12 13 |
# File 'lib/vagrant-terraform/config.rb', line 11 def api_token_secret @api_token_secret end |
#api_url ⇒ Object
Returns the value of attribute api_url.
9 10 11 |
# File 'lib/vagrant-terraform/config.rb', line 9 def api_url @api_url end |
#cpu_cores ⇒ Object
Returns the value of attribute cpu_cores.
19 20 21 |
# File 'lib/vagrant-terraform/config.rb', line 19 def cpu_cores @cpu_cores end |
#cpu_type ⇒ Object
Returns the value of attribute cpu_type.
20 21 22 |
# File 'lib/vagrant-terraform/config.rb', line 20 def cpu_type @cpu_type end |
#debug ⇒ Object
Returns the value of attribute debug.
14 15 16 |
# File 'lib/vagrant-terraform/config.rb', line 14 def debug @debug end |
#description ⇒ Object
Returns the value of attribute description.
24 25 26 |
# File 'lib/vagrant-terraform/config.rb', line 24 def description @description end |
#disk_size ⇒ Object
Returns the value of attribute disk_size.
17 18 19 |
# File 'lib/vagrant-terraform/config.rb', line 17 def disk_size @disk_size end |
#disks ⇒ Object (readonly)
Returns the value of attribute disks.
7 8 9 |
# File 'lib/vagrant-terraform/config.rb', line 7 def disks @disks end |
#full_clone ⇒ Object
Returns the value of attribute full_clone.
28 29 30 |
# File 'lib/vagrant-terraform/config.rb', line 28 def full_clone @full_clone end |
#insecure ⇒ Object
Returns the value of attribute insecure.
13 14 15 |
# File 'lib/vagrant-terraform/config.rb', line 13 def insecure @insecure end |
#memory_size ⇒ Object
Returns the value of attribute memory_size.
21 22 23 |
# File 'lib/vagrant-terraform/config.rb', line 21 def memory_size @memory_size end |
#nameserver ⇒ Object
Returns the value of attribute nameserver.
25 26 27 |
# File 'lib/vagrant-terraform/config.rb', line 25 def nameserver @nameserver end |
#onboot ⇒ Object
Returns the value of attribute onboot.
23 24 25 |
# File 'lib/vagrant-terraform/config.rb', line 23 def onboot @onboot end |
#os_type ⇒ Object
Returns the value of attribute os_type.
27 28 29 |
# File 'lib/vagrant-terraform/config.rb', line 27 def os_type @os_type end |
#searchdomain ⇒ Object
Returns the value of attribute searchdomain.
26 27 28 |
# File 'lib/vagrant-terraform/config.rb', line 26 def searchdomain @searchdomain end |
#serial_port ⇒ Object
Returns the value of attribute serial_port.
29 30 31 |
# File 'lib/vagrant-terraform/config.rb', line 29 def serial_port @serial_port end |
#storage_domain ⇒ Object
Returns the value of attribute storage_domain.
18 19 20 |
# File 'lib/vagrant-terraform/config.rb', line 18 def storage_domain @storage_domain end |
#target_node ⇒ Object
Returns the value of attribute target_node.
22 23 24 |
# File 'lib/vagrant-terraform/config.rb', line 22 def target_node @target_node end |
#template ⇒ Object
Returns the value of attribute template.
16 17 18 |
# File 'lib/vagrant-terraform/config.rb', line 16 def template @template end |
#vga ⇒ Object
Returns the value of attribute vga.
12 13 14 |
# File 'lib/vagrant-terraform/config.rb', line 12 def vga @vga end |
#vmname ⇒ Object
Returns the value of attribute vmname.
15 16 17 |
# File 'lib/vagrant-terraform/config.rb', line 15 def vmname @vmname end |
Instance Method Details
#finalize! ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/vagrant-terraform/config.rb', line 55 def finalize! @api_url = nil if @api_url == UNSET_VALUE @api_token_id = nil if @api_token_id == UNSET_VALUE @api_token_secret = nil if @api_token_secret == UNSET_VALUE @vga = 'virtio' if @vga == UNSET_VALUE @insecure = false if @insecure == UNSET_VALUE @debug = false if @debug == UNSET_VALUE @vmname = nil if @vmname == UNSET_VALUE @template = nil if @template == UNSET_VALUE @disk_size = nil if @disk_size == UNSET_VALUE @storage_domain = nil if @storage_domain == UNSET_VALUE @cpu_cores = 1 if @cpu_cores == UNSET_VALUE @cpu_type = 'host' if @cpu_type == UNSET_VALUE @memory_size = '512 MiB' if @memory_size == UNSET_VALUE @target_node = nil if @target_node == UNSET_VALUE @onboot = false if @onboot == UNSET_VALUE @description = '' if @description == UNSET_VALUE @nameserver = '' if @nameserver == UNSET_VALUE @searchdomain = '' if @searchdomain == UNSET_VALUE @os_type = 'l26' if @os_type == UNSET_VALUE @full_clone = true if @full_clone == UNSET_VALUE @serial_port = false if @serial_port == UNSET_VALUE unless disk_size.nil? begin @disk_size = Filesize.from(@disk_size).to_f('B').to_i rescue ArgumentError raise "Not able to parse 'disk_size' #{@disk_size}." end end begin @memory_size = Filesize.from(@memory_size).to_f('B').to_i rescue ArgumentError raise "Not able to parse `memory_size`." end end |