Closed toddrosner closed 4 years ago
Hello @toddrosner thanks for reaching out. Did this work for you previously?
Looking at the requirements for user assigned managed identities I believe that you must enter the full resource id /subscriptions/<SUBSCRIPTON ID>/resourcegroups/<RESOURCE GROUP>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<USER ASSIGNED IDENTITY NAME>
. Otherwise Packer will throw the error you specified above.
Please try updating the format and let me know if you are still running into trouble. If this worked previously, namely version 1.6.0, please advise so that we can take a look to see if anything changed. Thanks!
Hey @nywilken
That appears to have worked. I had tried the resource name and object ID with no success. Dug into the resource properties to find the actual resource ID and things are looking good now.
The error thrown by Packer does not lead you to understand what the problem is - so thanks for the reply!
Sounds like this feature could benefit from improved validation in the Prepare, to make sure that the input is in the right format.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Overview of the Issue
When using
user_assigned_managed_identities
in JSON template, the following error is returned:Expected even number of segments
Reproduction Steps
builders
section of JSON template:Packer version
1.6.1
Simplified Packer Buildfile
JSON template
``` { "variables": { "company": "", "env": "", "implementation": "", "location": "", "location_code": "", "project": "", "resource_group": "", "storage_account": "", "subscription_id": "", "version": "", "vm_size": "Standard_D2s_v3" }, "builders": [ { "azure_tags": { "Budget": "{{ user `env` | upper }}_VM", "Company": "{{ user `company` }}", "Environment": "{{ user `env` | upper }}", "Name": "{{ user `project` | upper }} {{ user `implementation` | upper }} {{ isotime }}", "OS": "Ubuntu 18.04 LTS", "Project": "{{ user `project` }}", "Service": "VM", "Tool": "Packer" }, "build_resource_group_name": "{{ user `resource_group` }}", "image_offer": "UbuntuServer", "image_publisher": "Canonical", "image_sku": "18.04-LTS", "managed_image_name": "{{ user `project` }}-{{ user `implementation` }}-{{ timestamp }}", "managed_image_resource_group_name": "{{ user `company` }}-{{ user `env` }}-{{ user `location` }}", "os_type": "Linux", "subscription_id": "{{ user `subscription_id` }}", "type": "azure-arm", "user_assigned_managed_identities": [ "azure-packer-id" ], "vm_size": "{{ user `vm_size` }}" } ], "provisioners": [ { "type": "file", "source": "scripts/docker-compose.yaml", "destination": "/tmp/docker-compose.yaml" }, { "execute_command": "echo 'Packer' | {{ .Vars }} sudo -S -E bash '{{ .Path }}'", "script": "scripts/user_data.sh", "type": "shell" }, { "disable_sudo": false, "local_state_tree": "salt", "type": "salt-masterless" }, { "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", "inline": [ "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" ], "inline_shebang": "/bin/sh -x", "type": "shell" } ] } ```Operating system and Environment details
MacOS 10.14.6
Log Fragments and crash.log files
PACKER_LOG=1
``` 2020/07/31 10:38:07 [INFO] Packer version: 1.6.1 [go1.13.14 darwin amd64] 2020/07/31 10:38:07 Checking 'PACKER_CONFIG' for a config file path 2020/07/31 10:38:07 'PACKER_CONFIG' not set; checking the default config file path 2020/07/31 10:38:07 Attempting to open config file: /Users/todd/.packerconfig 2020/07/31 10:38:07 [WARN] Config file doesn't exist: /Users/todd/.packerconfig 2020/07/31 10:38:07 Setting cache directory: /Users/todd/Documents/MonetaGo/Projects/ss-azure-iac/packer/templates/auth/admin/packer_cache 2020/07/31 10:38:07 Creating plugin client for path: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:07 Starting plugin: /opt/packer_1.6.1_darwin_amd64/packer []string{"/opt/packer_1.6.1_darwin_amd64/packer", "plugin", "packer-builder-azure-arm"} 2020/07/31 10:38:07 Waiting for RPC address for: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 packer-builder-azure-arm plugin: [INFO] Packer version: 1.6.1 [go1.13.14 darwin amd64] 2020/07/31 10:38:08 packer-builder-azure-arm plugin: Checking 'PACKER_CONFIG' for a config file path 2020/07/31 10:38:08 packer-builder-azure-arm plugin: 'PACKER_CONFIG' not set; checking the default config file path 2020/07/31 10:38:08 packer-builder-azure-arm plugin: Attempting to open config file: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-builder-azure-arm plugin: [WARN] Config file doesn't exist: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-builder-azure-arm plugin: Setting cache directory: /Users/todd/Documents/MonetaGo/Projects/ss-azure-iac/packer/templates/auth/admin/packer_cache 2020/07/31 10:38:08 packer-builder-azure-arm plugin: args: []string{"packer-builder-azure-arm"} 2020/07/31 10:38:08 packer-builder-azure-arm plugin: Plugin address: unix /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin529292056 2020/07/31 10:38:08 packer-builder-azure-arm plugin: Waiting for connection... 2020/07/31 10:38:08 Received unix RPC address for /opt/packer_1.6.1_darwin_amd64/packer: addr is /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin529292056 2020/07/31 10:38:08 packer-builder-azure-arm plugin: Serving a plugin connection... 2020/07/31 10:38:08 Creating plugin client for path: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 Starting plugin: /opt/packer_1.6.1_darwin_amd64/packer []string{"/opt/packer_1.6.1_darwin_amd64/packer", "plugin", "packer-provisioner-file"} 2020/07/31 10:38:08 Waiting for RPC address for: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 packer-provisioner-file plugin: [INFO] Packer version: 1.6.1 [go1.13.14 darwin amd64] 2020/07/31 10:38:08 packer-provisioner-file plugin: Checking 'PACKER_CONFIG' for a config file path 2020/07/31 10:38:08 packer-provisioner-file plugin: 'PACKER_CONFIG' not set; checking the default config file path 2020/07/31 10:38:08 packer-provisioner-file plugin: Attempting to open config file: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-file plugin: Setting cache directory: /Users/todd/Documents/MonetaGo/Projects/ss-azure-iac/packer/templates/auth/admin/packer_cache 2020/07/31 10:38:08 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"} 2020/07/31 10:38:08 packer-provisioner-file plugin: Plugin address: unix /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin450937636 2020/07/31 10:38:08 Received unix RPC address for /opt/packer_1.6.1_darwin_amd64/packer: addr is /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin450937636 2020/07/31 10:38:08 packer-provisioner-file plugin: Waiting for connection... 2020/07/31 10:38:08 packer-provisioner-file plugin: Serving a plugin connection... 2020/07/31 10:38:08 Creating plugin client for path: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 Starting plugin: /opt/packer_1.6.1_darwin_amd64/packer []string{"/opt/packer_1.6.1_darwin_amd64/packer", "plugin", "packer-provisioner-shell"} 2020/07/31 10:38:08 Waiting for RPC address for: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 packer-provisioner-shell plugin: [INFO] Packer version: 1.6.1 [go1.13.14 darwin amd64] 2020/07/31 10:38:08 packer-provisioner-shell plugin: Checking 'PACKER_CONFIG' for a config file path 2020/07/31 10:38:08 packer-provisioner-shell plugin: 'PACKER_CONFIG' not set; checking the default config file path 2020/07/31 10:38:08 packer-provisioner-shell plugin: Attempting to open config file: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-shell plugin: Setting cache directory: /Users/todd/Documents/MonetaGo/Projects/ss-azure-iac/packer/templates/auth/admin/packer_cache 2020/07/31 10:38:08 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"} 2020/07/31 10:38:08 packer-provisioner-shell plugin: Plugin address: unix /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin482532512 2020/07/31 10:38:08 Received unix RPC address for /opt/packer_1.6.1_darwin_amd64/packer: addr is /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin482532512 2020/07/31 10:38:08 packer-provisioner-shell plugin: Waiting for connection... 2020/07/31 10:38:08 packer-provisioner-shell plugin: Serving a plugin connection... 2020/07/31 10:38:08 Creating plugin client for path: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 Starting plugin: /opt/packer_1.6.1_darwin_amd64/packer []string{"/opt/packer_1.6.1_darwin_amd64/packer", "plugin", "packer-provisioner-salt-masterless"} 2020/07/31 10:38:08 Waiting for RPC address for: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: [INFO] Packer version: 1.6.1 [go1.13.14 darwin amd64] 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: Checking 'PACKER_CONFIG' for a config file path 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: 'PACKER_CONFIG' not set; checking the default config file path 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: Attempting to open config file: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: [WARN] Config file doesn't exist: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: Setting cache directory: /Users/todd/Documents/MonetaGo/Projects/ss-azure-iac/packer/templates/auth/admin/packer_cache 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: args: []string{"packer-provisioner-salt-masterless"} 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: Plugin address: unix /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin655622028 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: Waiting for connection... 2020/07/31 10:38:08 Received unix RPC address for /opt/packer_1.6.1_darwin_amd64/packer: addr is /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin655622028 2020/07/31 10:38:08 packer-provisioner-salt-masterless plugin: Serving a plugin connection... 2020/07/31 10:38:08 Creating plugin client for path: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 Starting plugin: /opt/packer_1.6.1_darwin_amd64/packer []string{"/opt/packer_1.6.1_darwin_amd64/packer", "plugin", "packer-provisioner-shell"} 2020/07/31 10:38:08 Waiting for RPC address for: /opt/packer_1.6.1_darwin_amd64/packer 2020/07/31 10:38:08 packer-provisioner-shell plugin: [INFO] Packer version: 1.6.1 [go1.13.14 darwin amd64] 2020/07/31 10:38:08 packer-provisioner-shell plugin: Checking 'PACKER_CONFIG' for a config file path 2020/07/31 10:38:08 packer-provisioner-shell plugin: 'PACKER_CONFIG' not set; checking the default config file path 2020/07/31 10:38:08 packer-provisioner-shell plugin: Attempting to open config file: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /Users/todd/.packerconfig 2020/07/31 10:38:08 packer-provisioner-shell plugin: Setting cache directory: /Users/todd/Documents/MonetaGo/Projects/ss-azure-iac/packer/templates/auth/admin/packer_cache 2020/07/31 10:38:08 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"} 2020/07/31 10:38:08 packer-provisioner-shell plugin: Plugin address: unix /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin049438328 2020/07/31 10:38:08 packer-provisioner-shell plugin: Waiting for connection... 2020/07/31 10:38:08 Received unix RPC address for /opt/packer_1.6.1_darwin_amd64/packer: addr is /var/folders/m7/drvtf22x1tsf4nxq507h_m880000gn/T/packer-plugin049438328 2020/07/31 10:38:08 packer-provisioner-shell plugin: Serving a plugin connection... 2020/07/31 10:38:08 Preparing build: azure-arm 2020/07/31 10:38:08 Build 'azure-arm' prepare failure: 1 error(s) occurred: * Expected even number of segments 1 error(s) occurred: * Expected even number of segments 2020/07/31 10:38:08 Build debug mode: false 2020/07/31 10:38:08 Force build: false Error: Failed to prepare build: "azure-arm" 2020/07/31 10:38:08 On error: 2020/07/31 10:38:08 Waiting on builds to complete... ==> Builds finished but no artifacts were created. 1 error(s) occurred: * Expected even number of segments ==> Builds finished but no artifacts were created. 2020/07/31 10:38:08 [INFO] (telemetry) Finalizing. 2020/07/31 10:38:09 waiting for all plugin processes to complete... 2020/07/31 10:38:09 /opt/packer_1.6.1_darwin_amd64/packer: plugin process exited 2020/07/31 10:38:09 /opt/packer_1.6.1_darwin_amd64/packer: plugin process exited 2020/07/31 10:38:09 /opt/packer_1.6.1_darwin_amd64/packer: plugin process exited 2020/07/31 10:38:09 /opt/packer_1.6.1_darwin_amd64/packer: plugin process exited 2020/07/31 10:38:09 /opt/packer_1.6.1_darwin_amd64/packer: plugin process exited No option given ```