Skip to content

Commit

Permalink
v1.7.1, update docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
josenk committed Aug 14, 2020
1 parent d00887e commit 4a3555c
Show file tree
Hide file tree
Showing 64 changed files with 487 additions and 714 deletions.
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Requirements

Building The Provider
---------------------
In general, you don't normally need to build the provider. A release can be downloaded from github, or can automatically be downloaded with terraform 0.13.

You first must set your GOPATH. If you are unsure, please review the documentation at.
>https://github.com/golang/go/wiki/SettingGOPATH
Expand All @@ -42,6 +43,7 @@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w -extldflags "-sta
sudo cp terraform-provider-esxi_`cat version` /usr/local/bin
```


Terraform-provider-esxi plugin
==============================
* This is a Terraform plugin that adds a VMware ESXi provider support. This allows Terraform to control and provision VMs directly on an ESXi hypervisor without a need for vCenter or VShpere. ESXi hypervisor is a free download from VMware!
Expand All @@ -54,14 +56,10 @@ Terraform-provider-esxi plugin
>https://configmax.vmware.com/guest



What's New:
-----------
* Terraform can import existing Guest VMs, Virtual Disks & Resource pools by name. See wiki page for more info.
>https://github.com/josenk/terraform-provider-esxi/wiki/How-to-import
* Added support for GuestInfo. (Thanks for the contribution silasb.)
* This adds great provisioning options like Ignition and Cloud-Init!
* Terraform 0.13 support. This provider is now in the terraform registry.
>https://registry.terraform.io/providers/josenk/esxi


Expand All @@ -73,6 +71,7 @@ Features and Compatibility
* Terraform will Create, Destroy, Update & Read Guest VMs.
* Terraform will Create, Destroy, Update & Read Extra Storage for Guests.


This is a provider! NOT a provisioner.
---------------------------------------
* This plugin does not configure your guest VM, it creates it.
Expand All @@ -81,6 +80,7 @@ This is a provider! NOT a provisioner.
* To help you get started, there is are examples in a separate repo I created. You can create a Pull Request if you would like to contribute.
* https://github.com/josenk/terraform-provider-esxi-wiki


Vagrant vs Terraform.
---------------------
If you are using vagrant as a deployment tool (infa as code), you may want to consider a better tool. Terraform. Vagrant is better for development environments, while Terraform is better at managing infrastructure. Please give my terraform plugin a try and give me some feedback. What you're trying to do, what's missing, what works, what doesn't work, etc...
Expand All @@ -96,8 +96,27 @@ Not everyone has vCenter, vSphere, expensive APIs... These cost $$$. ESXi is f

How to install
--------------
Download and install Terraform on your local system using instructions from https://www.terraform.io/downloads.html.
Clone this plugin from github, build and place a copy of it in your path or current directory of your terraform project. Or download pre-built binaries from https://github.com/josenk/terraform-provider-esxi/releases.
* Install terraform
* 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 {
esxi = {
source = "registry.terraform.io/josenk/esxi"
#
# For more information, see the provider source documentation:
# https://github.com/josenk/terraform-provider-esxi
# https://registry.terraform.io/providers/josenk/esxi
}
}
}
```
* Manual installation
* 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.



How to use and configure a main.tf file
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions examples-0.13/01 Simple Guest/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# See https://www.terraform.io/intro/getting-started/variables.html for more details.
#

# Change these defaults to fit your needs!

variable "esxi_hostname" {
default = "esxi"
}

variable "esxi_hostport" {
default = "22"
}

variable "esxi_hostssl" {
default = "443"
}

variable "esxi_username" {
default = "root"
}

variable "esxi_password" { # Unspecified will prompt
}

15 changes: 15 additions & 0 deletions examples-0.13/01 Simple Guest/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

terraform {
required_version = ">= 0.13"
required_providers {
esxi = {
source = "registry.terraform.io/josenk/esxi"
#
# For more information, see the provider source documentation:
#
# https://github.com/josenk/terraform-provider-esxi
# https://registry.terraform.io/providers/josenk/esxi
#
}
}
}
25 changes: 25 additions & 0 deletions examples-0.13/02 Cloned Guest - Complete build/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# See https://www.terraform.io/intro/getting-started/variables.html for more details.
#

# Change these defaults to fit your needs!

variable "esxi_hostname" {
default = "esxi"
}

variable "esxi_hostport" {
default = "22"
}

variable "esxi_hostssl" {
default = "443"
}

variable "esxi_username" {
default = "root"
}

variable "esxi_password" { # Unspecified will prompt
}

15 changes: 15 additions & 0 deletions examples-0.13/02 Cloned Guest - Complete build/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

terraform {
required_version = ">= 0.13"
required_providers {
esxi = {
source = "registry.terraform.io/josenk/esxi"
#
# For more information, see the provider source documentation:
#
# https://github.com/josenk/terraform-provider-esxi
# https://registry.terraform.io/providers/josenk/esxi
#
}
}
}
30 changes: 30 additions & 0 deletions examples-0.13/03 Resource Pools - Additional Storage/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# See https://www.terraform.io/intro/getting-started/variables.html for more details.
#

# Change these defaults to fit your needs!

variable "esxi_hostname" {
default = "esxi"
}

variable "esxi_hostport" {
default = "22"
}

variable "esxi_hostssl" {
default = "443"
}


variable "esxi_username" {
default = "root"
}

variable "esxi_password" { # Unspecified will prompt
}

variable "disk_store" {
default = "DS_001"
}

15 changes: 15 additions & 0 deletions examples-0.13/03 Resource Pools - Additional Storage/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

terraform {
required_version = ">= 0.13"
required_providers {
esxi = {
source = "registry.terraform.io/josenk/esxi"
#
# For more information, see the provider source documentation:
#
# https://github.com/josenk/terraform-provider-esxi
# https://registry.terraform.io/providers/josenk/esxi
#
}
}
}
6 changes: 6 additions & 0 deletions examples-0.13/04 CoreOS and Ignition/example.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Service]
Type=oneshot
ExecStart=/usr/bin/echo Hello World

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions examples-0.13/04 CoreOS and Ignition/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "ip" {
value = [esxi_guest.coreos.ip_address]
}

30 changes: 30 additions & 0 deletions examples-0.13/04 CoreOS and Ignition/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# See https://www.terraform.io/intro/getting-started/variables.html for more details.
#

# Change these defaults to fit your needs!

variable "esxi_hostname" {
default = "esxi"
}

variable "esxi_hostport" {
default = "22"
}

variable "esxi_hostssl" {
default = "443"
}

variable "esxi_username" {
default = "root"
}

variable "esxi_password" {
# Unspecified will prompt
}

variable "disk_store" {
default = "datastore0"
}

15 changes: 15 additions & 0 deletions examples-0.13/04 CoreOS and Ignition/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

terraform {
required_version = ">= 0.13"
required_providers {
esxi = {
source = "registry.terraform.io/josenk/esxi"
#
# For more information, see the provider source documentation:
#
# https://github.com/josenk/terraform-provider-esxi
# https://registry.terraform.io/providers/josenk/esxi
#
}
}
}
4 changes: 4 additions & 0 deletions examples-0.13/05 CloudInit and Templates/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "ip" {
value = [esxi_guest.Default.ip_address]
}

27 changes: 27 additions & 0 deletions examples-0.13/05 CloudInit and Templates/userdata.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#cloud-config

packages:
- ntp
- ntpdate


# Add yum repository configuration to the system
yum_repos:
# The name of the repository
epel-testing:
# Any repository configuration options
# See: man yum.conf
#
# This one is required!
baseurl: http://download.fedoraproject.org/pub/epel/testing/5/$basearch
enabled: false
failovermethod: priority
gpgcheck: true
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
name: Extra Packages for Enterprise Linux 5 - Testing

runcmd:
- date >/root/cloudinit.log
- hostnamectl set-hostname ${HOSTNAME}
- echo ${HELLO} >>/root/cloudinit.log
- echo "Done cloud-init" >>/root/cloudinit.log
34 changes: 34 additions & 0 deletions examples-0.13/05 CloudInit and Templates/userinit.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#cloud-config

packages:
- ntp
- ntpdate


# Override ntp with chrony configuration on Ubuntu
ntp:
enabled: true
ntp_client: chrony # Uses cloud-init default chrony configuration


# Add yum repository configuration to the system
yum_repos:
# The name of the repository
epel-testing:
# Any repository configuration options
# See: man yum.conf
#
# This one is required!
baseurl: http://download.fedoraproject.org/pub/epel/testing/5/$basearch
enabled: false
failovermethod: priority
gpgcheck: true
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
name: Extra Packages for Enterprise Linux 5 - Testing

runcmd:
- date >/root/cloudinit.log
- hostnamectl set-hostname ${HOSTNAME}
- echo ${HELLO} >>/root/cloudinit.log
- echo "Done cloud-init" >>/root/cloudinit.log

38 changes: 38 additions & 0 deletions examples-0.13/05 CloudInit and Templates/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# See https://www.terraform.io/intro/getting-started/variables.html for more details.
#

# Change these defaults to fit your needs!

variable "esxi_hostname" {
default = "esxi"
}

variable "esxi_hostport" {
default = "22"
}

variable "esxi_hostssl" {
default = "443"
}

variable "esxi_username" {
default = "root"
}

variable "esxi_password" {
# Unspecified will prompt
}

variable "virtual_network" {
default = "VM Network"
}

variable "disk_store" {
default = "DiskStore01"
}

variable "vm_hostname" {
default = "vmtest05"
}

15 changes: 15 additions & 0 deletions examples-0.13/05 CloudInit and Templates/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

terraform {
required_version = ">= 0.13"
required_providers {
esxi = {
source = "registry.terraform.io/josenk/esxi"
#
# For more information, see the provider source documentation:
#
# https://github.com/josenk/terraform-provider-esxi
# https://registry.terraform.io/providers/josenk/esxi
#
}
}
}
Loading

0 comments on commit 4a3555c

Please sign in to comment.