Open Cache1geT opened 2 years ago
This is a HCL format problem, you can use "system_disk_mapping" without "=" like this: system_disk_mapping { disk_category = "cloud_essd" } that's packer-plugin-alicloud define "system_disk_mapping" as a struct, and define "run_tags" as a Map, so you can use "run_tags" with "=" like run_tags = { "Built by" = "Packer" "Managed by" = "Packer" }
Overview of the Issue
While the failed information was reported when building an image using an HCL format configuration, the target image can be successfully built by a JSON format configuration with the same content.
Reproduction Steps
HCL format configuration(named alicloud.pkr.hcl):
packer init alicloud.pkr.hcl
packer build alicloud.pkr.hcl
Plugin and Packer version
Plugin version: alicloud v1.0.1
Pakcer version: packer v1.7.10
Simplified Packer Buildfile
`packer { required_plugins{ alicloud = { version = ">= 1.0.1" source = "github.com/hashicorp/alicloud" } } } source "alicloud-ecs" "install-sgx"{ image_name = "sgx-env-installed" source_image = "ubuntu_18_04_uefi_x64_20G_alibase_20210609.vhd" ssh_username = "root" instance_type = "ecs.g7t.large" io_optimized = true internet_charge_type = "PayByTraffic" system_disk_mapping = { "disk_category" = "cloud_essd" } run_tags = { "Built by" = "Packer" "Managed by" = "Packer" } }
build{ sources = ["sources.alicloud-ecs.install-sgx"] provisioner "shell"{ script = "./enable-sgx.sh" } }`
Operating system and Environment details
Operating system: ubuntu 18.04
packer version: ubuntu 18.04
Log Fragments and crash.log files
Log
2022/02/25 11:48:47 [INFO] Packer version: 1.7.10 [go1.17.6 linux amd64] 2022/02/25 11:48:47 [TRACE] discovering plugins in /usr/bin 2022/02/25 11:48:47 [TRACE] discovering plugins in /root/.config/packer/plugins 2022/02/25 11:48:47 [TRACE] discovering plugins in . 2022/02/25 11:48:47 [INFO] PACKER_CONFIG env var not set; checking the default config file path 2022/02/25 11:48:47 [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig 2022/02/25 11:48:47 [WARN] Config file doesn't exist: /root/.packerconfig 2022/02/25 11:48:47 [INFO] Setting cache directory: /root/.cache/packer 2022/02/25 11:48:47 [TRACE] listing potential installations for "github.com/hashicorp/alicloud" that match ">= 1.0.1". plugingetter.ListInstallationsOptions{FromFolders:[]stri ng{"/usr/bin/packer", ".", "/root/.config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linu x", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc00015a100)}}}} 2022/02/25 11:48:47 [TRACE] Found the following "github.com/hashicorp/alicloud" installations: [{/root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicl oud_v1.0.1_x5.0_linux_amd64 v1.0.1}] 2022/02/25 11:48:47 [INFO] found external [ecs] builders from alicloud plugin 2022/02/25 11:48:47 [INFO] found external [import] post-processors from alicloud plugin 2022/02/25 11:48:47 [TRACE] Starting external plugin /root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 start builder ec s 2022/02/25 11:48:47 Starting plugin: /root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 []string{"/root/.config/packer/p lugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64", "start", "builder", "ecs"} 2022/02/25 11:48:47 Waiting for RPC address for: /root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 2022/02/25 11:48:47 Received unix RPC address for /root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64: addr is /tmp/packe r-plugin570028700 2022/02/25 11:48:47 packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 plugin: 2022/02/25 11:48:47 Plugin address: unix /tmp/packer-plugin570028700 2022/02/25 11:48:47 packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 plugin: 2022/02/25 11:48:47 Waiting for connection... 2022/02/25 11:48:47 packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 plugin: 2022/02/25 11:48:47 Serving a plugin connection... 2022/02/25 11:48:47 packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64 plugin: 2022/02/25 11:48:47 [TRACE] starting builder ecs on alicloud.pkr.hcl line 16: (source code not available) An argument named "system_disk_mapping" is not expected here. Did you mean to define a block of type "system_disk_mapping"? Error: Unsupported argument on alicloud.pkr.hcl line 16: (source code not available) An argument named "system_disk_mapping" is not expected here. Did you mean to define a block of type "system_disk_mapping"? 2022/02/25 11:48:47 Build debug mode: false 2022/02/25 11:48:47 Force build: false 2022/02/25 11:48:47 On error: 2022/02/25 11:48:47 Waiting on builds to complete... ==> Wait completed after 97 microseconds ==> Wait completed after 97 microseconds ==> Builds finished but no artifacts were created. ==> Builds finished but no artifacts were created. 2022/02/25 11:48:47 [INFO] (telemetry) Finalizing. 2022/02/25 11:48:48 waiting for all plugin processes to complete... 2022/02/25 11:48:48 /root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.0.1_x5.0_linux_amd64: plugin process exited