mirror of https://github.com/hashicorp/packer
Merge pull request #12257 from hashicorp/backport/nywilken/hcl2upgrade-variables-empty-map/rationally-suited-walrus
This pull request was automerged via backport-assistantpull/12272/head
commit
e2ca082117
@ -0,0 +1,33 @@
|
||||
|
||||
variable "ssh_host" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ssh_password" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ssh_username" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "version_tag" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "null" "autogenerated_1" {
|
||||
communicator = "ssh"
|
||||
ssh_host = "${var.ssh_host}"
|
||||
ssh_password = "${var.ssh_password}"
|
||||
ssh_username = "${var.ssh_username}"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["source.null.autogenerated_1"]
|
||||
|
||||
provisioner "shell-local" {
|
||||
inline = ["echo ${var.version_tag} > provision.txt"]
|
||||
pause_before = "20s"
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"type": "null",
|
||||
"communicator": "ssh",
|
||||
"ssh_host": "{{ user `ssh_host` }}",
|
||||
"ssh_password": "{{ user `ssh_password` }}",
|
||||
"ssh_username": "{{ user `ssh_username` }}"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"pause_before": "20s",
|
||||
"type": "shell-local",
|
||||
"inline": [ "echo {{ user `version_tag` }} > provision.txt" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"version_tag": "1.0.0",
|
||||
"ssh_host": "localhost",
|
||||
"ssh_username": "packer",
|
||||
"ssh_password": "packer"
|
||||
}
|
||||
Loading…
Reference in new issue