mirror of https://github.com/hashicorp/packer
hcl2_upgrade: special case: vsphere fix (#11216)
* fix typo * hcl2_upgrade: special case linux_options and network_interface to block instead of maps * Update hcl2_upgrade_test.go * Update hcl2_upgrade_test.go remove unused code * hcl2_upgrade: support strftime too (#11220) * hcl2_upgrade strftime function * create legacy_strftime.mdxpull/11224/head
parent
1d915adad1
commit
eb8e302941
@ -0,0 +1,41 @@
|
||||
|
||||
source "vsphere-clone" "autogenerated_1" {
|
||||
RAM_reserve_all = false
|
||||
cluster = "USER_VALUE"
|
||||
convert_to_template = false
|
||||
customize {
|
||||
dns_server_list = ["192.168.254.1", "192.168.254.2"]
|
||||
ipv4_gateway = "172.15.102.254"
|
||||
linux_options {
|
||||
domain = "test.internal"
|
||||
host_name = "packer-test"
|
||||
}
|
||||
network_interface {
|
||||
ipv4_address = "172.15.102.202"
|
||||
ipv4_netmask = "24"
|
||||
}
|
||||
}
|
||||
datacenter = "USER_VALUE"
|
||||
datastore = "USER_VALUE"
|
||||
disable_shutdown = true
|
||||
disk_controller_type = ["pvscsi", "pvscsi"]
|
||||
insecure_connection = "true"
|
||||
network = "USER_VALUE"
|
||||
notes = "Build via Packer"
|
||||
password = "USER_VALUE"
|
||||
ssh_password = "Aa123456"
|
||||
ssh_username = "root"
|
||||
storage {
|
||||
disk_controller_index = 0
|
||||
disk_size = 100000
|
||||
}
|
||||
template = "erez's template"
|
||||
username = "USER_VALUE"
|
||||
vcenter_server = "USER_VALUE"
|
||||
vm_name = "USER_VALUE"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["source.vsphere-clone.autogenerated_1"]
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"disable_shutdown": true,
|
||||
"type": "vsphere-clone",
|
||||
"vcenter_server": "USER_VALUE",
|
||||
"username": "USER_VALUE",
|
||||
"password": "USER_VALUE",
|
||||
"insecure_connection": "true",
|
||||
"datacenter": "USER_VALUE",
|
||||
"cluster": "USER_VALUE",
|
||||
"network": "USER_VALUE",
|
||||
"datastore": "USER_VALUE",
|
||||
"vm_name": "USER_VALUE",
|
||||
"notes": "Build via Packer",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "Aa123456",
|
||||
"template": "erez's template",
|
||||
"RAM_reserve_all": false,
|
||||
"convert_to_template": false,
|
||||
"disk_controller_type": [
|
||||
"pvscsi",
|
||||
"pvscsi"
|
||||
],
|
||||
"storage": [
|
||||
{
|
||||
"disk_controller_index": 0,
|
||||
"disk_size": 100000
|
||||
}
|
||||
],
|
||||
"customize": {
|
||||
"linux_options": {
|
||||
"host_name": "packer-test",
|
||||
"domain": "test.internal"
|
||||
},
|
||||
"network_interface": {
|
||||
"ipv4_address": "172.15.102.202",
|
||||
"ipv4_netmask": "24"
|
||||
},
|
||||
"ipv4_gateway": "172.15.102.254",
|
||||
"dns_server_list": [
|
||||
"192.168.254.1",
|
||||
"192.168.254.2"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
---
|
||||
page_title: legacy_strftime - Functions - Configuration Language
|
||||
description: |-
|
||||
The legacy_strftime function returns a string representation of the current date
|
||||
and time.
|
||||
---
|
||||
|
||||
# `legacy_strftime` — UTC time, formated using the ISO C standard format
|
||||
|
||||
The `legacy_strftime` function returns the current date and time using the given
|
||||
format string. The format string follows strftime's datetime formatting.
|
||||
|
||||
This function has been provided to create backwards compatibility with Packer's
|
||||
legacy JSON templates. However, we recommend that you upgrade your HCL Packer
|
||||
template to use
|
||||
[`timestamp`](/docs/templates/hcl_templates/functions/datetime/timestamp) and
|
||||
[`formatdate`](/docs/templates/hcl_templates/functions/datetime/formatdate)
|
||||
together as soon as is convenient.
|
||||
|
||||
-> **Note:** If you are using a large number of builders, provisioners or
|
||||
post-processors, the strftime may be slightly different for each one because it
|
||||
is from when the plugin is launched not the initial Packer process. In order to
|
||||
avoid this and make the timestamp consistent across all plugins, set it as a
|
||||
user variable and then access the user variable within your plugins.
|
||||
|
||||
## Examples
|
||||
|
||||
```shell-session
|
||||
> legacy_strftime("%Y-%m")
|
||||
2021-08
|
||||
```
|
||||
|
||||
## Related Functions
|
||||
|
||||
- [`format`](/docs/templates/hcl_templates/functions/string/format) is a more general formatting function for arbitrary
|
||||
data.
|
||||
- [`timestamp`](/docs/templates/hcl_templates/functions/datetime/timestamp) returns the current date and time in a format
|
||||
suitable for input to `formatdate`.
|
||||
- [`formatdate`](/docs/templates/hcl_templates/functions/datetime/formatdate) can convert the resulting timestamp to
|
||||
other date and time formats.
|
||||
Loading…
Reference in new issue