Skip to content

Commit

Permalink
v1.7.2 Correctly set numvcpu when using clone_from_vm
Browse files Browse the repository at this point in the history
  • Loading branch information
josenk committed Sep 8, 2020
1 parent 4a3555c commit e26b330
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ How to install
* Download and install Terraform on your local system using instructions from https://www.terraform.io/downloads.html.
* Automatic install
* Add the required_providers block to your terraform project.
```
```
terraform {
required_version = ">= 0.13"
required_providers {
Expand All @@ -114,7 +114,7 @@ terraform {
}
}
```
* Manual installation
* Manual installation (Terraform 0.11.x or 0.12.x only)
* Download pre-built binaries from https://github.com/josenk/terraform-provider-esxi/releases. Place a copy of it in your path or current directory of your terraform project.


Expand Down Expand Up @@ -256,6 +256,7 @@ Known issues with vmware_esxi

Version History
---------------
* 1.7.2 Correctly set numvcpu when using clone_from_vm that doesn't have a numvcpu key set.
* 1.7.1 Bump release to include support for Terraform 0.13
* 1.7.0 Add support for esxi_hostssl (Setting the ssl port for ovftool).
* 1.6.4 Fix default IP dection. Fix Disk Stores containing spaces.
Expand Down
11 changes: 8 additions & 3 deletions esxi/guest_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ func updateVmx_contents(c *Config, vmid string, iscreate bool, memsize int, numv

// modify numvcpus
if numvcpus != 0 {
re := regexp.MustCompile("numvcpus = \".*\"")
regexReplacement = fmt.Sprintf("numvcpus = \"%d\"", numvcpus)
vmx_contents = re.ReplaceAllString(vmx_contents, regexReplacement)
if strings.Contains(vmx_contents, "numvcpus = ") {
re := regexp.MustCompile("numvcpus = \".*\"")
regexReplacement = fmt.Sprintf("numvcpus = \"%d\"", numvcpus)
vmx_contents = re.ReplaceAllString(vmx_contents, regexReplacement)
} else {
log.Printf("[updateVmx_contents] Add numvcpu: %d\n", numvcpus)
vmx_contents += fmt.Sprintf("\nnumvcpus = \"%d\"", numvcpus)
}
}

// modify virthwver
Expand Down
2 changes: 1 addition & 1 deletion examples-0.12/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Terraform esxi Provider
=======================


This directory hold the examples for terraform 0.12.x+
This directory hold the examples for terraform 0.12.x
------------------------------------------------------
2 changes: 1 addition & 1 deletion examples-0.13/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Terraform esxi Provider
=======================


This directory hold the examples for terraform 0.12.x+
This directory hold the examples for terraform 0.13.x+
------------------------------------------------------
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ require (
github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734
)

go 1.13
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.7.1
v1.7.2

0 comments on commit e26b330

Please sign in to comment.