hashicorp / hashicorp/packer

Not empty array printed as empty

Open
#13,484 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Overview of the Issue

```
build {
sources = ["source.amazon-ebs.nomad_ami"]

provisioner "shell-local" {
inline = [
"echo length: ${jsonencode(length( local.ami_regions ))}",
"echo AMI Regions: ${jsonencode(local.ami_regions)}",
]
}

```

Having this block I see output:
```
amazon-ebs.nomad_ami: length: 1
amazon-ebs.nomad_ami: AMI Regions: []
```

If ami_regions array is not empty it should be printed as [""]

#### Reproduction Steps

see above

### Packer version

v1.11.2

### Operating system and Environment details

```
Darwin Mac 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6030 arm64 arm Darwin
```

### Log Fragments and crash.log files

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.