hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.03k stars 3.32k forks source link

Panic on uncorrect build source name (HCL2) #8539

Closed timurb closed 4 years ago

timurb commented 4 years ago

Overview of the Issue

If you create reference to source in incorrect format in HCL2 you'll get panic instead of nice error.

Reproduction Steps

Try to build this hcl file

source "amazon-ebs" "ami" {
}

build {
  sources = ["ami"]
}

This ☝️ produces panic and a crash log.

If instead you change sources line into sources = ["source.amazon-ebs.ami"] you get error about missing params in builder section as I would expect.

Packer version

Packer v1.5.1

Operating system and Environment details

MacOS 10.14.6

Log Fragments and crash.log files

https://gist.github.com/timurb/58fc6ecded95666959d4694e75746936

azr commented 4 years ago

Hey @timurb good catch, thanks for opening ! I created a fix here #8569

ghost commented 4 years ago

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.