You can't interpolate type and it wouldn't help much since they generally
will have different options. If you really want to template type you can
preprocess your template (with sed etc.).

On Nov 2, 2017 22:04, "Sabitha M" <[email protected]> wrote:

> Hi ,
>
> Here is my packer template. I am trying to pass command line arguments for
> packer build of type cloud. But I am getting error
>
> Failed to initialize build '': builder type not found: {{user 
> `cloud_provider`}}
> Failed to initialize build 'amazon-ebs': builder type not found: {{user 
> `cloud_provider`}}
>  [1;32mamazon-ebs output will be in this color. [0m
>
>
> ==> Builds finished but no artifacts were created.
>
>
> {
>   "variables": {
>     "cloud_provider": "",
>     "image_id": ""
>   },
>   "builders": [{
>     "type": "{{user `cloud_provider`}}",
>     "region": "us-west-2",
>     "source_ami": "{{user `image_id`}}",
>     "instance_type": "t2.micro",
>     "vpc_id":"xxxx-80d4",
>     "ssh_username": "ec2-user",
>     "subnet_id": "xxxx-4d",
>     "security_group_id": "xxx-14f5",
>     "ami_name": "JENKINS_PACKER_{{timestamp}}",
>     "tags": {
>     "Key": "Name",
>     "Value": "JENKINS_PACKER_{{timestamp}}"
>     }
>   }],
>  "provisioners": [
>   {
>   "type": "shell",
>   "inline": [
>     "sleep 10",
>     "sudo yum -y update",
>     "sudo yum -y install java-1.8.0-openjdk.x86_64",
>     "curl -O https://bootstrap.pypa.io/get-pip.py";,
>     "sudo python get-pip.py",
>     "sudo pip install --upgrade awscli"
>   ]
>   }
>   ]
>
> --
> 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/815b3eba-63dc-4cee-b32c-d9e097bab8ec%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/815b3eba-63dc-4cee-b32c-d9e097bab8ec%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/CALz9Rt8HqJeBrjRXtEvyvuNGPYjSEd7-Lia8_7iRMz8BAt8SYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to