Do you run it in cmd or Powershell? I'm pretty sure that is working and is
not a bug. But I don't have any Windows machine to test on. What happens if
you drop the quotes. I would suspect that it's just the windows shell that
parses things different.
Try this template (test.json):
{
"variables": { "avar": "testing" },
"builders": [ {
"type": "file",
"content": "{{ user `avar` }} World!",
"target": "file.txt"
} ]
}
And run
packer build -var avar=Hello test.json; cat file.txt
On 20 October 2016 at 01:32, Chris Marks <[email protected]> wrote:
> Hi,
> I'm running into something that I'm not sure I understand. Here's my
> (stripped down for example) use case: I want to create an AMI where the
> name includes the environment it is built for (test, prod, etc). Here's
> the packer file (named testVar.json):
> {
> "variables": {
> "aws_access_key": "",
> "aws_secret_key": "",
> "cpe_env": "test"
> },
> "builders": [{
> "type": "amazon-ebs",
> "access_key": "{{user `aws_access_key`}}",
> "secret_key": "{{user `aws_secret_key`}}",
> "region": "us-west-2",
> "source_ami": "ami-b04e92d0",
> "instance_type": "t2.micro",
> "ssh_username": "ec2-user",
> "ami_name": "TestAMI-{{isotime \"20060102-1504\"}}-{{user `cpe_env`}}",
> "vpc_id": "someVPC",
> "subnet_id": "someSubnet"
> }]
> }
>
>
> When I run the following Packer command on Windows 10, I end up with an
> AMI name like "TestAMI-20161019-2241-test". When I run the same command
> on Linux (Amazon Linux), I end up with an AMI name like
> "TestAMI-20161019-2241-prod".
> I think this is a bug in Packer, but wanted to check here before submitting
> in case I'm missing something.
>
> packer build -var 'aws_access_key=someAccessKey' -var
> 'aws_secret_key=someSecretKey' -var 'cpe_env=prod' testVar.json
>
> I've tried this Packer 0.10.1 and 0.10.2.
>
> Thanks,
> topher
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/c345373e-abe9-491f-bd43-3d4d71f99083%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/c345373e-abe9-491f-bd43-3d4d71f99083%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/CALz9Rt_WUT1qxi8-nD4_Mhom6H%2BYd99tjcu30cCk9Dfdttczbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.