Skip to content

Commit

Permalink
Merge branch 'upstream/master' into instant_module
Browse files Browse the repository at this point in the history
  • Loading branch information
Anant Chopra committed May 4, 2021
2 parents c0461ef + bdfc368 commit bfd146d
Show file tree
Hide file tree
Showing 2,467 changed files with 269,354 additions and 255,260 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ website/node_modules
*~
.*.swp
.idea
.vscode
*.iml
*.test
*.iml
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 1.26.0 (April 20, 2021)

BUG FIXES:
* Minor fixes of issues that came up during testing against vSphere 7.0
* Change the way we set the timeout for maintenance mode ([#1392](https://github.com/hashicorp/terraform-provider-vsphere/pull/1392))

IMPROVEMENTS:
* `provider`: vSphere 7 compatibility validation ([#1381](https://github.com/hashicorp/terraform-provider-vsphere/pull/1381))
* `resource/vm`: Allow hardware version up to 19 ([#1391](https://github.com/hashicorp/terraform-provider-vsphere/pull/1391))

## 1.25.0 (March 17, 2021)

BUG FIXES:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ This provider plugin is maintained by the Terraform team at [HashiCorp](https://
## Requirements
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x
- Note that version 0.11.x currently works, but is [deprecated](https://www.hashicorp.com/blog/deprecating-terraform-0-11-support-in-terraform-providers/)
- vSphere 6.5
- Currently, this provider is not tested for vSphere 7, but plans are underway to add support.
- vSphere version
- This provider supports vSphere versions in accordance with the [VMware Product Lifecycle Matrix](https://lifecycle.vmware.com/#/), from General Availability until the End of General Support
- [Go](https://golang.org/doc/install) 1.16.x (to build the provider plugin)

## Building The Provider
Expand Down
4 changes: 2 additions & 2 deletions _about/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
The HashiCorp Terraform vSphere provider team is :

* Phil Sautter, Product Manager - [@redeux](https://github.com/redeux)
* Bill Rich, Engineer - [@bill-rich](https://github.com/bill-rich)
* Alex Pilon, Engineer - [@appilon](https://github.com/appilon)
* Kyriakos Oikonomakos, Engineer - [@koikonom](https://github.com/koikonom)
* Aareet Shermon, Engineering Manager - [@aareet](https://github.com/aareet)
* Aareet Mahadevan, Engineering Manager - [@aareet](https://github.com/aareet)

### Why isn’t my PR merged yet?

Expand Down
18 changes: 8 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ module github.com/hashicorp/terraform-provider-vsphere
go 1.16

require (
github.com/aws/aws-sdk-go v1.28.8 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.37.0 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 // indirect
github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02 // indirect
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.7.0
github.com/hashicorp/hcl/v2 v2.8.2 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.6.1
github.com/mitchellh/copystructure v1.0.0
github.com/terraform-providers/terraform-provider-null v1.0.1-0.20191204185112-e5c592237f62
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f
github.com/vmware/govmomi v0.24.1
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150 // indirect
github.com/vmware/govmomi v0.25.0
golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect
google.golang.org/api v0.34.0 // indirect

)
540 changes: 420 additions & 120 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/hashicorp/terraform-plugin-sdk/plugin"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/hashicorp/terraform-provider-vsphere/vsphere"
)

Expand Down
65 changes: 65 additions & 0 deletions scripts/packet/devrc.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export TF_VAR_VCSA_DEPLOY_PATH="/tmp/vcsa/vcsa-cli-installer/mac/vcsa-deploy"
export TF_VAR_PRIV_KEY='<your ssh key>'
export TF_VAR_VSPHERE_REST_SESSION_PATH=$HOME/.govmomi/rest_sessions
export TF_VAR_VSPHERE_VIM_SESSION_PATH=$HOME/.govmomi/sessions
export TF_VAR_VSPHERE_LICENSE=00000-00000-00000-00000-00000
export TF_VAR_PACKET_PROJECT=00000000-0000-0000-0000-000000000000
export TF_VAR_PACKET_AUTH=00000000000000000000000000000000
#export TF_VAR_ESXI_VERSION="vmware_esxi_7_0"
export TF_VAR_ESXI_VERSION="vmware_esxi_6_7"

export TF_VAR_VSPHERE_NAS_HOST=${nas_host}
export TF_VAR_VSPHERE_ESXI1=${esxi_host_1}
export TF_VAR_VSPHERE_ESXI2=${esxi_host_2}
export VSPHERE_SERVER=${vsphere_host}

export TF_VAR_VSPHERE_VMFS_REGEXP='naa.6000c29[2b]'
export TF_VAR_VSPHERE_DS_VMFS_ESXI1_DISK0="naa.6000c29b4b217432a854822b1bc40502"
export TF_VAR_VSPHERE_DS_VMFS_ESXI1_DISK1="naa.6000c29f3dbf773c6c25cb830dfc201b"

export VSPHERE_USER="[email protected]"
export VSPHERE_PASSWORD="Password123!"
export VSPHERE_ALLOW_UNVERIFIED_SSL=true

export TF_VAR_VSPHERE_SERVER=$VSPHERE_SERVER
export TF_VAR_VSPHERE_USER=$VSPHERE_USER
export TF_VAR_VSPHERE_PASSWORD=$VSPHERE_PASSWORD
export TF_VAR_VSPHERE_ALLOW_UNVERIFIED_SSL=$VSPHERE_ALLOW_UNVERIFIED_SSL
export TF_VAR_VSPHERE_ESXI_TRUNK_NIC=vmnic1
export TF_VAR_VSPHERE_DATACENTER=hashidc
export TF_VAR_VSPHERE_CLUSTER=c1
export TF_VAR_VSPHERE_NFS_DS_NAME=nfs
export TF_VAR_VSPHERE_NFS_DS_NAME1=nfs-vol1
export TF_VAR_VSPHERE_NFS_DS_NAME2=nfs-vol2
export TF_VAR_VSPHERE_DVS_NAME=terraform-test-dvs
export TF_VAR_VSPHERE_PG_NAME='vmnet'
export TF_VAR_VSPHERE_RESOURCE_POOL=hashi-resource-pool
export TF_VAR_VSPHERE_NFS_PATH=/nfs
export TF_VAR_VSPHERE_NFS_PATH1=/nfs/ds1
export TF_VAR_VSPHERE_NFS_PATH2=/nfs/ds2
export TF_VAR_VSPHERE_ISO_DATASTORE=nfs
export TF_VAR_VSPHERE_ISO_FILE=fake.iso
export TF_VAR_REMOTE_OVA_URL="https://storage.googleapis.com/acctest-images/tfvsphere_template.ova"
export TF_VAR_VSPHERE_TEMPLATE=tfvsphere_template
export TF_VAR_VSPHERE_INIT_TYPE=thin
export TF_VAR_VSPHERE_ADAPTER_TYPE=lsiLogic
export TF_VAR_VSPHERE_DC_FOLDER=dc-folder
export TF_VAR_VSPHERE_DS_FOLDER=ds
export TF_VAR_VSPHERE_USE_LINKED_CLONE=true
export TF_VAR_VSPHERE_PERSIST_SESSION=true
export TF_VAR_VSPHERE_CLONED_VM_DISK_SIZE=20
export TF_VAR_VSPHERE_TEST_OVA="https://storage.googleapis.com/acctest-images/yVM.ova"
export TF_VAR_VSPHERE_TEST_OVF="https://storage.googleapis.com/acctest-images/yVM.ovf"
export TF_VAR_VSPHERE_CONTENT_LIBRARY_FILES="https://storage.googleapis.com/acctest-images/yVM.ovf"
export TF_VAR_REMOTE_OVF_URL=https://acctest-images.storage.googleapis.com/tfvsphere_template.ovf

export TF_VAR_VSPHERE_HOST_NIC0=vmnic0
export TF_VAR_VSPHERE_HOST_NIC1=vmnic1


export TF_VAR_VSPHERE_VSWITCH_UPPER_VERSION="7.0.0"
export TF_VAR_VSPHERE_VSWITCH_LOWER_VERSION="6.5.0"
export TF_VAR_VSPHERE_DS_VMFS_NAME='ds-001'
export TF_VAR_VSPHERE_VM_V1_PATH='pxe-server'
export TF_VAR_VSPHERE_FOLDER_V0_PATH='Discovered virtual machine'
export TF_VAR_VSPHERE_ENTITY_PERMISSION_USER_GROUP="root"
85 changes: 69 additions & 16 deletions scripts/packet/main.tf.phase1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ variable "PACKET_PROJECT" {}

variable "PRIV_KEY" {}

variable "VCSA_DEPLOY_PATH" {}

variable "ESXI_VERSION" {
default = "vmware_esxi_6_7"
}

variable "PACKET_FACILITY" {
default = "sjc1"
}

variable ESXI_PLAN {
default = "c3.medium.x86"
}

variable STORAGE_PLAN {
default = "c1.small.x86"
}

variable LAB_PREFIX {
default = ""
}

provider "packet" {
auth_token = var.PACKET_AUTH
}
Expand All @@ -46,10 +68,10 @@ provider "vsphere" {
}

resource "packet_device" "esxi1" {
hostname = "esxi1.vspheretest.internal"
plan = "c3.medium.x86"
facilities = ["sjc1"]
operating_system = "vmware_esxi_6_7"
hostname = "${var.LAB_PREFIX}esxi1.vspheretest.internal"
plan = var.ESXI_PLAN
facilities = [var.PACKET_FACILITY]
operating_system = var.ESXI_VERSION
billing_cycle = "hourly"
project_id = local.project_id
}
Expand All @@ -60,10 +82,10 @@ resource "packet_device_network_type" "esxi1" {
}

resource "packet_device" "esxi2" {
hostname = "esxi2.vspheretest.internal"
plan = "c3.medium.x86"
facilities = ["sjc1"]
operating_system = "vmware_esxi_6_7"
hostname = "${var.LAB_PREFIX}esxi2.vspheretest.internal"
plan = var.ESXI_PLAN
facilities = [var.PACKET_FACILITY]
operating_system = var.ESXI_VERSION
billing_cycle = "hourly"
project_id = local.project_id
}
Expand All @@ -74,36 +96,56 @@ resource "packet_device_network_type" "esxi2" {
}

resource "packet_device" "storage1" {
hostname = "storage1.vspheretest.internal"
plan = "c1.small.x86"
facilities = ["sjc1"]
hostname = "${var.LAB_PREFIX}storage1.vspheretest.internal"
plan = var.STORAGE_PLAN
facilities = [var.PACKET_FACILITY]
operating_system = "ubuntu_20_04"
billing_cycle = "hourly"
project_id = local.project_id
provisioner "remote-exec" {
inline = [
"mkdir /nfs",
"mkdir -p /nfs/ds1 /nfs/ds2 /nfs/ds2 /nfs/ds3",
"apt-get update",
"apt-get install nfs-common nfs-kernel-server -y",
"echo \"/nfs *(rw,no_root_squash)\" > /etc/exports",
"echo \"/nfs/ds1 *(rw,no_root_squash)\" >> /etc/exports",
"echo \"/nfs/ds2 *(rw,no_root_squash)\" >> /etc/exports",
"echo \"/nfs/ds3 *(rw,no_root_squash)\" >> /etc/exports",
"exportfs -a",
]
connection {
host = packet_device.storage1.network.0.address
private_key = var.PRIV_KEY
private_key = file(var.PRIV_KEY)
}
}
}

resource "packet_vlan" "vmvlan" {
facility = var.PACKET_FACILITY
project_id = local.project_id
}

resource "packet_port_vlan_attachment" "vmvlan_esxi1" {
device_id = packet_device.esxi1.id
port_name = "eth1"
vlan_vnid = packet_vlan.vmvlan.vxlan
}

resource "packet_port_vlan_attachment" "vmvlan_esxi2" {
device_id = packet_device.esxi2.id
port_name = "eth1"
vlan_vnid = packet_vlan.vmvlan.vxlan
}

data "packet_precreated_ip_block" "private" {
facility = "sjc1"
facility = var.PACKET_FACILITY
project_id = local.project_id
address_family = 4
public = false
}

data "packet_precreated_ip_block" "public" {
facility = "sjc1"
facility = var.PACKET_FACILITY
project_id = local.project_id
address_family = 4
public = true
Expand Down Expand Up @@ -137,10 +179,21 @@ resource "local_file" "vcsa_template" {
})
filename = "./tmp/vcsa.json"
provisioner "local-exec" {
command = "sleep 290; echo five more; sleep 290; TERM=xterm-256color ./tmp/mnt/vcsa-cli-installer/lin64/vcsa-deploy install --accept-eula --acknowledge-ceip --no-ssl-certificate-verification --verbose --skip-ovftool-verification ./tmp/vcsa.json"
command = "sleep 290; echo five more; sleep 290; TERM=xterm-256color ${var.VCSA_DEPLOY_PATH} install --accept-eula --acknowledge-ceip --no-ssl-certificate-verification --verbose --skip-ovftool-verification $(pwd)/tmp/vcsa.json"
}
}

output "ip" {
value = cidrhost("${packet_device.esxi1.network.0.address}/${packet_device.esxi1.network.0.cidr}",3)
}

resource "local_file" "devrc" {
sensitive_content = templatefile("${path.cwd}/devrc.tpl", {
nas_host = packet_device.storage1.network.0.address
esxi_host_1 = packet_device.esxi1.network.0.address
esxi_host_2 = packet_device.esxi2.network.0.address
vsphere_host = cidrhost("${packet_device.esxi1.network.0.address}/${packet_device.esxi1.network.0.cidr}",3)

})
filename = "./devrc"
}
Loading

0 comments on commit bfd146d

Please sign in to comment.