From 7f0dbdebb28c182a4fc665924afb259c47668fb8 Mon Sep 17 00:00:00 2001 From: Joshua Foster Date: Mon, 13 Apr 2020 14:28:50 -0400 Subject: [PATCH] clean up documentation for new NIC and storage params adding examples, updating .gitattributes so *.mdx files have LF endings for windows --- .gitattributes | 1 + builder/vsphere/iso/step_create.go | 33 ++++++++++++++++++- .../docs/builders/vmware/vsphere-iso.mdx | 16 ++++++--- .../vsphere/iso/DiskConfig-required.mdx | 2 +- .../builder/vsphere/iso/DiskConfig.mdx | 16 +++++++++ .../partials/builder/vsphere/iso/NIC.mdx | 17 ++++++++++ 6 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 website/pages/partials/builder/vsphere/iso/DiskConfig.mdx create mode 100644 website/pages/partials/builder/vsphere/iso/NIC.mdx diff --git a/.gitattributes b/.gitattributes index 30f357a76..6c076338a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ *.sh text eol=lf *.json text eol=lf *.md text eol=lf +*.mdx text eol=lf *.ps1 text eol=lf *.hcl text eol=lf go.mod text eol=lf diff --git a/builder/vsphere/iso/step_create.go b/builder/vsphere/iso/step_create.go index f3366a0b5..6d179ecfc 100644 --- a/builder/vsphere/iso/step_create.go +++ b/builder/vsphere/iso/step_create.go @@ -13,6 +13,22 @@ import ( "github.com/hashicorp/packer/packer" ) +// Defines a Network Adapter +// +// Example that creates two network adapters: +// +// ```json +// "network_adapters": [ +// { +// "network": "VM Network", +// "network_card": "vmxnet3" +// }, +// { +// "network": "OtherNetwork", +// "network_card": "vmxnet3" +// } +// ], +// ``` type NIC struct { // Set network VM will be connected to. Network string `mapstructure:"network"` @@ -24,8 +40,23 @@ type NIC struct { Passthrough *bool `mapstructure:"passthrough"` } +// Defines the disk storage for a VM. +// +// Example that will create a 15GB and a 20GB disk on the VM. The second disk will be thin provisioned: +// +// ```json +// "storage": [ +// { +// "disk_size": 15000, +// }, +// { +// "disk_size": 20000, +// "disk_thin_provisioned": true +// } +// ], +// ``` type DiskConfig struct { - // Set the size of the disk + // The size of the disk in MB. DiskSize int64 `mapstructure:"disk_size" required:"true"` // Enable VMDK thin provisioning for VM. Defaults to `false`. DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"` diff --git a/website/pages/docs/builders/vmware/vsphere-iso.mdx b/website/pages/docs/builders/vmware/vsphere-iso.mdx index abaee7e52..91df31003 100644 --- a/website/pages/docs/builders/vmware/vsphere-iso.mdx +++ b/website/pages/docs/builders/vmware/vsphere-iso.mdx @@ -105,12 +105,22 @@ from the datastore. Example: ### Network Adapter Configuration +@include 'builder/vsphere/iso/NIC.mdx' + @include 'builder/vsphere/iso/NIC-required.mdx' +#### Optional + +@include 'builder/vsphere/iso/NIC-not-required.mdx' + ### Storage Configuration +@include 'builder/vsphere/iso/DiskConfig.mdx' + @include 'builder/vsphere/iso/DiskConfig-required.mdx' +#### Optional + @include 'builder/vsphere/iso/DiskConfig-not-required.mdx' ### Floppy Configuration @@ -121,7 +131,7 @@ from the datastore. Example: @include 'builder/vsphere/common/ExportConfig.mdx' -### Optional: +#### Optional: @include 'builder/vsphere/common/ExportConfig-not-required.mdx' @@ -139,10 +149,6 @@ from the datastore. Example: @include 'helper/communicator/Config-not-required.mdx' -#### Optional Network Adapter fields: - -@include 'builder/vsphere/iso/NIC-not-required.mdx' - #### Optional SSH fields: @include 'helper/communicator/SSH-not-required.mdx' diff --git a/website/pages/partials/builder/vsphere/iso/DiskConfig-required.mdx b/website/pages/partials/builder/vsphere/iso/DiskConfig-required.mdx index 4bdf8c3cb..7321c05d1 100644 --- a/website/pages/partials/builder/vsphere/iso/DiskConfig-required.mdx +++ b/website/pages/partials/builder/vsphere/iso/DiskConfig-required.mdx @@ -1,4 +1,4 @@ -- `disk_size` (int64) - Set the size of the disk +- `disk_size` (int64) - The size of the disk in MB. \ No newline at end of file diff --git a/website/pages/partials/builder/vsphere/iso/DiskConfig.mdx b/website/pages/partials/builder/vsphere/iso/DiskConfig.mdx new file mode 100644 index 000000000..292a182dc --- /dev/null +++ b/website/pages/partials/builder/vsphere/iso/DiskConfig.mdx @@ -0,0 +1,16 @@ + +Defines the disk storage for a VM. + +Example that will create a 15GB and a 20GB disk on the VM. The second disk will be thin provisioned: + +```json + "storage": [ + { + "disk_size": 15000, + }, + { + "disk_size": 20000, + "disk_thin_provisioned": true + } + ], +``` diff --git a/website/pages/partials/builder/vsphere/iso/NIC.mdx b/website/pages/partials/builder/vsphere/iso/NIC.mdx new file mode 100644 index 000000000..cd8dc304f --- /dev/null +++ b/website/pages/partials/builder/vsphere/iso/NIC.mdx @@ -0,0 +1,17 @@ + +Defines a Network Adapter + +Example that creates two network adapters: + +```json + "network_adapters": [ + { + "network": "VM Network", + "network_card": "vmxnet3" + }, + { + "network": "OtherNetwork", + "network_card": "vmxnet3" + } + ], +```