#!/bin/bash
eval "$(jq -r '@sh "FOO=\(.foo) BAZ=\(.baz)"')"--
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/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/54f60a88-fb7e-441e-a316-2798811390d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
All that bash is doing is reading in the query values into variables, though since bash doesn't know JSON natively, it's convoluted.In Ruby it would be more straightforward:#!/usr/bin/env rubyrequire 'json'data = JSON.parse(STDIN.read)Then if the vars passed were `foo` and `bar`, they would be available to ruby as `data['foo']` and `data['bar']`.
On Sun, Feb 26, 2017 at 11:58 PM, Vikas Kumar <vika...@gmail.com> wrote:
Hey All,This link shows how to use vars passed by external data source in a bash script.#!/bin/bash
eval "$(jq -r '@sh "FOO=\(.foo) BAZ=\(.baz)"')"What would be the ruby equivalent of this?Cheers,Vikas
--
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/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.