vagrant-terraform 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0950b52c922bc9c326421581112c78ce6f809b881d776d722c163c257d2533db'
4
- data.tar.gz: 2b338a1ad80608402402014432ddadbf7dcaa48b525eb26b9f3c1a2028879879
3
+ metadata.gz: dacbe62294c85a5ec69042adae409df5b1ec31dad1ed5f1700c172931ff5a98b
4
+ data.tar.gz: 6b3eb82e39e8eb7c791f2c3ca9c3aff71074a2446fa8dae5cba7389271695d2e
5
5
  SHA512:
6
- metadata.gz: dbd1bc88e4160d35c8a24d755f14da84284e5a3281fa1fa2d0db6602e924c8d2a90b55352255538b28ae3f7233bf4b117c027a3c6377fd9d56946a316b617b0f
7
- data.tar.gz: ea80d8464356373470f57c330ded91a6ee5dfa7bd7584f85902ef21445ad8f8c53f62c6e51468a85cfb33fbbd100510ca4b0286053282d535daf74d366c5ada5
6
+ metadata.gz: 58b44ccfbb6005bbfd22fb548fcaef0f1357e7f984435d2c598eafe06bae935a62e2731c60e5e2e150771cd12f716cd272855b844c9532022724162b4a2409e5
7
+ data.tar.gz: 38278548028309af518e1f323eb420dc422915a1aa52ffeaa512a3dd3f7b03db54b9c2d5026e69fffe3526c3cdd2a04e387fc601eee646c77e9edb79be3288c1
@@ -45,13 +45,14 @@ provider "proxmox" {
45
45
  resource "proxmox_vm_qemu" "#{vmname.gsub(/\./, '-')}" {
46
46
  name = "#{vmname}"
47
47
  target_nodes = ["#{config.target_node}"]
48
- desc = "#{config.description}"
48
+ desc = "#{config.description}"
49
49
  vm_state = "stopped"
50
50
  clone = "#{config.template}"
51
51
  full_clone = "#{config.full_clone}"
52
52
  cores = #{config.cpu_cores.to_i}
53
+ cpu_type = "#{config.cpu_type}"
53
54
  memory = #{Filesize.from("#{config.memory_size} B").to_f('MiB').to_i}
54
- onboot = #{config.onboot}
55
+ onboot = #{config.onboot}
55
56
  agent = 1
56
57
  vga {
57
58
  type = "#{config.vga}"
@@ -170,7 +171,23 @@ END
170
171
  terraform_main_file = "#{terraform_dir}/main.tf"
171
172
 
172
173
  File.write(terraform_main_file, main_tf)
173
- terraform_execute(env, 'terraform init')
174
+
175
+ retryable(on: Errors::TerraformError, tries: 100, sleep: 1) do
176
+ begin
177
+ terraform_execute(env, 'terraform init')
178
+ rescue Errors::TerraformError => e
179
+ # https://github.com/hashicorp/terraform/issues/32915
180
+ # https://github.com/hashicorp/terraform/issues/31964
181
+ # The message 'text file busy' comes when something is attempting to overwrite the executable
182
+ # for a running process which is using the same data. The plugin cache is not safe for concurrent
183
+ # access, and overwriting running providers can result in unexpected behavior.
184
+ ansi_escape_regex = /\e\[(?:[0-9]{1,2}(?:;[0-9]{1,2})*)?[m|K]/
185
+ if e.message.gsub(ansi_escape_regex, '').include?("Failed to install provider")
186
+ @logger.debug("Failed to install provider, retrying")
187
+ raise e
188
+ end
189
+ end
190
+ end
174
191
 
175
192
  retryable(on: Errors::TerraformError, tries: 10, sleep: 1) do
176
193
  begin
@@ -193,7 +210,7 @@ END
193
210
 
194
211
  # Terraform error message was 'clone failed: 'storage-qnap-nfs'-locked command timed out - aborting'
195
212
  if e.message.gsub(ansi_escape_regex, '').include?("command timed out")
196
- env[:ui].info("Proxmox clone failed, retrying")
213
+ env[:ui].info("Proxmox clone failed with command timeout, retrying")
197
214
  raise e
198
215
  end
199
216
 
@@ -205,7 +222,20 @@ END
205
222
 
206
223
  # Terraform error message was 'volume 'qnap-nfs:104/vm-104-disk-1.raw' does not exist'
207
224
  if e.message.gsub(ansi_escape_regex, '') =~ /.*volume .* does not exist/
208
- env[:ui].info("Volume not created, retrying")
225
+ # https://github.com/bpg/terraform-provider-proxmox/issues/1599
226
+ env[:ui].info("Volume not created, retrying. Error was: #{e.message}")
227
+ raise e
228
+ end
229
+
230
+ # Terraform error message was 'clone failed: disk image '/mnt/pve/qnap-nfs/images/104/vm-104-cloudinit.qcow2' already exists'
231
+ if e.message.gsub(ansi_escape_regex, '') =~ /.*disk image .* already exists/
232
+ env[:ui].info("Clone failed, retrying. Error was: #{e.message}")
233
+ raise e
234
+ end
235
+
236
+ # Creation failed. Terraform error message was 'clone failed: unable to create image: qemu-img: /mnt/pve/qnap-nfs/images/105/vm-105-cloudinit.qcow2: Could not create '/mnt/pve/qnap-nfs/images/105/vm-105-cloudinit.qcow2': No such file or directory'
237
+ if e.message.gsub(ansi_escape_regex, '') =~ /.*unable to create image .* No such file or directory/
238
+ env[:ui].info("Clone failed, retrying. Error was: #{e.message}")
209
239
  raise e
210
240
  end
211
241
 
@@ -17,6 +17,7 @@ module VagrantPlugins
17
17
  attr_accessor :disk_size
18
18
  attr_accessor :storage_domain
19
19
  attr_accessor :cpu_cores
20
+ attr_accessor :cpu_type
20
21
  attr_accessor :memory_size
21
22
  attr_accessor :target_node
22
23
  attr_accessor :onboot
@@ -31,7 +32,7 @@ module VagrantPlugins
31
32
  @api_url = UNSET_VALUE
32
33
  @api_token_id = UNSET_VALUE
33
34
  @api_token_secret = UNSET_VALUE
34
- @vga = UNSET_VALUE
35
+ @vga = UNSET_VALUE
35
36
  @insecure = UNSET_VALUE
36
37
  @debug = UNSET_VALUE
37
38
  @vmname = UNSET_VALUE
@@ -39,6 +40,7 @@ module VagrantPlugins
39
40
  @disk_size = UNSET_VALUE
40
41
  @storage_domain = UNSET_VALUE
41
42
  @cpu_cores = UNSET_VALUE
43
+ @cpu_type = UNSET_VALUE
42
44
  @memory_size = UNSET_VALUE
43
45
  @target_node = UNSET_VALUE
44
46
  @onboot = UNSET_VALUE
@@ -62,6 +64,7 @@ module VagrantPlugins
62
64
  @disk_size = nil if @disk_size == UNSET_VALUE
63
65
  @storage_domain = nil if @storage_domain == UNSET_VALUE
64
66
  @cpu_cores = 1 if @cpu_cores == UNSET_VALUE
67
+ @cpu_type = 'host' if @cpu_type == UNSET_VALUE
65
68
  @memory_size = '512 MiB' if @memory_size == UNSET_VALUE
66
69
  @target_node = nil if @target_node == UNSET_VALUE
67
70
  @onboot = false if @onboot == UNSET_VALUE
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  module TerraformProvider
3
- VERSION = '0.1.10'
3
+ VERSION = '0.1.11'
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mika Båtsman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-24 00:00:00.000000000 Z
11
+ date: 2025-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filesize