Skip to content

Commit 4e363a5

Browse files
authored
Merge pull request #572 from hashicorp/refactor/clone-example
refactor: clone example
2 parents aea1a97 + 8035df2 commit 4e363a5

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

examples/builder/vsphere-clone/alpine/alpine.pkr.hcl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,10 @@ packer {
1010
}
1111
}
1212

13-
variable "vm_name_prefix" {
14-
type = string
15-
default = "alpine"
16-
description = "Prefix for naming the virtual machine."
17-
}
18-
19-
variable "guest_os_type" {
13+
variable "vcenter_server" {
2014
type = string
21-
default = "other5xLinux64Guest"
22-
description = "The type of guest OS to configure for the virtual machine."
15+
default = "vcenter.example.com"
16+
description = "The vCenter instance used for managing the ESX host."
2317
}
2418

2519
variable "username" {
@@ -36,10 +30,10 @@ variable "password" {
3630
description = "The password for authenticating with the vCenter instance."
3731
}
3832

39-
variable "vcenter_server" {
40-
type = string
41-
default = "vcenter.example.com"
42-
description = "The vCenter instance used for managing the ESX host."
33+
variable "insecure_connection" {
34+
type = bool
35+
default = true
36+
description = "Set to true to allow insecure connections to the vCenter instance."
4337
}
4438

4539
variable "host" {
@@ -48,31 +42,37 @@ variable "host" {
4842
description = "The ESX host where the virtual machine will be built."
4943
}
5044

51-
variable "insecure_connection" {
52-
type = bool
53-
default = true
54-
description = "Set to true to allow insecure connections to the vCenter instance."
45+
variable "datastore" {
46+
type = string
47+
default = "local-ssd01-esx01"
48+
description = "The datastore host where the virtual machine will be built."
5549
}
5650

57-
variable "communicator"
51+
variable "vm_name_prefix" {
52+
type = string
53+
default = "alpine"
54+
description = "Prefix for naming the virtual machine."
55+
}
56+
57+
variable "communicator" {
5858
type = string
5959
default = "none"
6060
}
6161

6262
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
6363

6464
source "vsphere-clone" "example" {
65-
communicator = var.communicator
65+
vcenter_server = var.vcenter_server
6666
username = var.username
6767
password = var.password
68-
vcenter_server = var.vcenter_server
69-
host = var.host
7068
insecure_connection = var.insecure_connection
69+
host = var.host
70+
datastore = var.datastore
7171
vm_name = "${var.vm_name_prefix}-${local.timestamp}"
7272
template = var.vm_name_prefix
73+
communicator = var.communicator
7374
}
7475

7576
build {
7677
sources = ["source.vsphere-clone.example"]
77-
7878
}

0 commit comments

Comments
 (0)