formatting fixes

This commit is contained in:
John Bowdre 2023-04-19 13:37:41 -05:00
parent 3a13a5b3fa
commit 6cd9786752
2 changed files with 8 additions and 9 deletions

View file

@ -5,7 +5,6 @@
// BLOCK: packer // BLOCK: packer
// The Packer configuration. // The Packer configuration.
packer { packer {
required_version = ">= 1.8.2" required_version = ">= 1.8.2"
required_plugins { required_plugins {
@ -20,20 +19,22 @@ packer {
} }
} }
// BLOCK: locals // BLOCK: data
// Defines the local variables. // Defines data sources.
data "sshkey" "install" { data "sshkey" "install" {
type = "ed25519" type = "ed25519"
name = "packer_key" name = "packer_key"
} }
// BLOCK: locals
// Defines local variables.
locals { locals {
ssh_public_key = data.sshkey.install.public_key ssh_public_key = data.sshkey.install.public_key
ssh_private_key_file = data.sshkey.install.private_key_path ssh_private_key_file = data.sshkey.install.private_key_path
build_tool = "HashiCorp Packer ${packer.version}" build_tool = "HashiCorp Packer ${packer.version}"
build_date = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) build_date = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp())
build_description = "Kubernetes Ubuntu 20.04 Node template\nBuild date: ${local.build_date}\nBuild tool: ${local.build_tool}" build_description = "Kubernetes Ubuntu 20.04 Node template\nBuild date: ${local.build_date}\nBuild tool: ${local.build_tool}"
shutdown_command = "sudo -S -E shutdown -P now" shutdown_command = "sudo /usr/sbin/shutdown -P now"
iso_paths = ["[${var.common_iso_datastore}] ${var.iso_path}/${var.iso_file}"] iso_paths = ["[${var.common_iso_datastore}] ${var.iso_path}/${var.iso_file}"]
iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum_value}" iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum_value}"
data_source_content = { data_source_content = {
@ -54,7 +55,6 @@ locals {
// BLOCK: source // BLOCK: source
// Defines the builder configuration blocks. // Defines the builder configuration blocks.
source "vsphere-iso" "ubuntu-k8s" { source "vsphere-iso" "ubuntu-k8s" {
// vCenter Server Endpoint Settings and Credentials // vCenter Server Endpoint Settings and Credentials
@ -152,7 +152,6 @@ source "vsphere-iso" "ubuntu-k8s" {
// BLOCK: build // BLOCK: build
// Defines the builders to run, provisioners, and post-processors. // Defines the builders to run, provisioners, and post-processors.
build { build {
sources = [ sources = [
"source.vsphere-iso.ubuntu-k8s" "source.vsphere-iso.ubuntu-k8s"
@ -174,6 +173,7 @@ build {
provisioner "shell" { provisioner "shell" {
execute_command = "bash {{ .Path }}" execute_command = "bash {{ .Path }}"
expect_disconnect = true
scripts = var.pre_final_scripts scripts = var.pre_final_scripts
} }
} }

View file

@ -317,7 +317,6 @@ variable "common_shutdown_timeout" {
variable "build_username" { variable "build_username" {
type = string type = string
description = "The username to login to the guest operating system. ('admin')" description = "The username to login to the guest operating system. ('admin')"
sensitive = true
} }
variable "build_password" { variable "build_password" {