I managed to get this done by getting the value of ami_name in builders 
section using jq, and passing it as it is, to 'execute_command' under 
provisioners section. Since execute_command also 
honors user variables, it is working fine. Thanks Alvaro.



On Wednesday, November 29, 2017 at 7:48:25 PM UTC+5:30, sibi das wrote:
>
> The problem is dynamic variables. For eg. for below section, the exact 
> name of ami will be known only during build time.
>
> "builders":[{
>   ...
>   ...
>   "ami_name": "packer-quick-start {{*timestamp*}}"
> }]
>
>
> On Wednesday, November 29, 2017 at 7:09:35 PM UTC+5:30, Alvaro Miranda 
> Aguilera wrote:
>>
>> why not getting it from the metadata in the script ?
>>
>> On Wed, Nov 29, 2017 at 1:13 PM, sibi das <[email protected]> wrote:
>>
>>> I need the AMI name of the image being built. The target AMI name or you 
>>> can say the futuristic value. The same name that we see in packer logs : 
>>> *Prevalidating 
>>> AMI Name: ******
>>>
>>> On Wednesday, November 29, 2017 at 5:20:12 PM UTC+5:30, Alvaro Miranda 
>>> Aguilera wrote:
>>>>
>>>> you want the source ami from where this AMI was created?
>>>> or you want the current AMI of the running instance ?
>>>>
>>>>
>>>>
>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>>>  Virusvrij. 
>>>> www.avast.com 
>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>>>  
>>>> <#[email protected]_CAHqq0exM-e591XX9hTsBLSqvOGaPbPnt+Xi3sNKtS6rM+VYwUg@mail.gmail.com_m_-6175332954109468886_CAHqq0ex0JoyZOj0=D3wuzFPwJbjVfYBfVpYAw+guucmUSdRt0A@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>
>>> -- 
>>> 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/ffb570a8-9f68-4bcd-8647-40c449dbfe3b%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/packer-tool/ffb570a8-9f68-4bcd-8647-40c449dbfe3b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Alvaro
>>
>>

-- 
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/c159e647-64fa-4d1a-8023-3fa0d4cd9421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to