You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
Both packer validate and packer build are throwing an error for a valid ami_name. I'm using timestamp and format to build the ami_name but even with trimmed down string it still throws the error. More interestingly, the build still runs and the ami is built with the name specified. If I use -only the error is not generated.
I should note that I have my source and build blocks separated as it's building several different amis off of the same source, but other image configurations I have that only have a single build template do not generate this error
Reproduction Steps
Create a packer file to have your source definition
Create another packer file with your build definition.
OS, Architecture, and any other information you can provide about the
environment.
Log Fragments and crash.log files
Error: 2 error(s) occurred:
* ami_name must be specified
* ami_name must be between 3 and 128 characters long
on packer/devops/jenkins-agents/sources.pkr.hcl line 10:
(source code not available)
Error: 2 error(s) occurred:
* ami_name must be specified
* ami_name must be between 3 and 128 characters long
on packer/devops/jenkins-agents/sources.pkr.hcl line 10:
(source code not available)
Error: 2 error(s) occurred:
* ami_name must be specified
* ami_name must be between 3 and 128 characters long
on packer/devops/jenkins-agents/sources.pkr.hcl line 10:
(source code not available)
Error: 2 error(s) occurred:
* ami_name must be specified
* ami_name must be between 3 and 128 characters long
on packer/devops/jenkins-agents/sources.pkr.hcl line 10:
(source code not available)
The text was updated successfully, but these errors were encountered:
Hi @dylanfoster thanks for reaching out and for providing the detailed issue.
Looking at the configurations I see that you have a main source block source "amazon-ebs" "debian-docker-base", which you then reference in the build blocks contained in build.android.pkr.hcl and build.web.pkr.hcl.
Are "web" and "android" the builds you are referring to when you say "the build still runs and the ami is built"?
Since you are you are including sources = ["source.amazon-ebs.debian-docker-base"] in each of the build blocks Packer will try to execute a build for the base source block but will fail with the error you provided because ami_name is not set.
Given the configuration of your template setting an ami_name in sources.pkr.hcl will prevent you from overriding the ami_name in other source references. So I suggest replacing the sources = ["source.amazon-ebs.debian-docker-base"] in build.android.pkr.hcl and build.web.pkr.hcl with another source reference block. For example
#build.android.pkr.hclbuild {
name="android"source"amazon-ebs.debian-docker-base" {
name="android"ami_name="images/jenkins-agent-android"ami_description=local.ami-description["android"]
tags=merge(
local.default-tags,
{
Name ="jenkins-agent-android""Android API Version"="system-images;android-25;google_apis;armeabi-v7a""Android SDK Version"="sdk-tools-linux-4333796"
}
)
}
source"amazon-ebs.debian-docker-base" {
name="base"# Change this name to what you see fitami_name="images/jenkins-agent-base"ami_description="base description".....
}
}
Alternatively if the source block in sources.pkr.hcl is just meant to be a shared cofiguration that you reference in other build blocks you can just remove ["source.amazon-ebs.debian-docker-base"] from each build block.
Please let use know if this suggested change resolves your issue.
Community Note
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
Both
packer validate
andpacker build
are throwing an error for a valid ami_name. I'm using timestamp and format to build the ami_name but even with trimmed down string it still throws the error. More interestingly, the build still runs and the ami is built with the name specified. If I use-only
the error is not generated.I should note that I have my source and build blocks separated as it's building several different amis off of the same source, but other image configurations I have that only have a single build template do not generate this error
Reproduction Steps
Create a packer file to have your source definition
Create another packer file with your build definition.
Packer version
From
packer version
Simplified Packer Template
gist
Operating system and Environment details
OS, Architecture, and any other information you can provide about the
environment.
Log Fragments and crash.log files
The text was updated successfully, but these errors were encountered: