@@ -235,18 +235,68 @@ <h3 id="_list_workspaces">List workspaces</h3>
235235< h2 id ="_tools "> Tools</ h2 >
236236< div class ="sectionbody ">
237237< div class ="sect2 ">
238+ < h3 id ="_jq "> jq</ h3 >
239+ < p class =""> jq is a lightweight command-line JSON processor. Combined with terraform output it can be powerful.</ p >
240+ < div class ="sect3 ">
241+ < h4 id ="_installaton "> Installaton</ h4 >
242+ < p class =""> For Linux:</ p >
243+ < p class =""> < code > $ sudo apt-get install jq</ code > </ p >
244+ < p class =""> For OS X:</ p >
245+ < p class =""> < code > $ brew install jq</ code > </ p >
246+ </ div >
247+ < div class ="sect3 ">
248+ < h4 id ="_usage_2 "> Usage</ h4 >
249+ < p class =""> For example, we defind outputs in a module and when we execute < em > terraform apply</ em > outputs are displayed:</ p >
250+ < div class ="literalblock ">
251+ < div class ="content ">
252+ < pre > $ terraform apply
253+ ...
254+
255+ Apply complete! Resources: 0 added, 0 changed,
256+ 0 destroyed.
257+
258+ Outputs:
259+
260+ elastic_endpoint = vpc-toto-12fgfd4d5f4ds5fngetwe4.
261+ eu-central-1.es.amazonaws.com</ pre >
262+ </ div >
263+ </ div >
264+ < p class =""> We can extract the value that we want in order to use it in a script for xample. With jq it’s easy:</ p >
265+ < div class ="literalblock ">
266+ < div class ="content ">
267+ < pre > $ terraform output -json
268+ {
269+ "elastic_endpoint": {
270+ "sensitive": false,
271+ "type": "string",
272+ "value": "vpc-toto-12fgfd4d5f4ds5fngetwe4.
273+ eu-central-1.es.amazonaws.com"
274+ }
275+ }
276+
277+ $ terraform output -json | jq '.elastic_endpoint.value'
278+ "vpc-toto-12fgfd4d5f4ds5fngetwe4.eu-central-1.
279+ es.amazonaws.com"</ pre >
280+ </ div >
281+ </ div >
282+ </ div >
283+ </ div >
284+ < div class ="sect2 ">
238285< h3 id ="_terraforming "> Terraforming</ h3 >
239286< p class =""> If you have an existing AWS account for examples with existing components like
240287S3 buckets, SNS, VPC … You can use terraforming tool, a tool written in Ruby,
241288which extract existing AWS resources and convert it to Terraform files!</ p >
242289< div class ="sect3 ">
243- < h4 id ="_install_terraforming " > Install Terraforming </ h4 >
290+ < h4 id ="_installation_2 " > Installation </ h4 >
244291< div class ="literalblock ">
245292< div class ="content ">
246293< pre > $ sudo apt install ruby
247294$ gem install terraforming</ pre >
248295</ div >
249296</ div >
297+ </ div >
298+ < div class ="sect3 ">
299+ < h4 id ="_usage_3 "> Usage</ h4 >
250300< p class =""> Pre-requisites :</ p >
251301< p class =""> Like for Terraform, you need to set AWS credentials</ p >
252302< div class ="literalblock ">
@@ -334,8 +384,7 @@ <h3 id="_error_configuring_the_backend_s3_requesterror_send_request_failed">Erro
334384the values in your configuration, run "terraform init".</ pre >
335385</ div >
336386</ div >
337- < p class =""> It caused in reality by the proxy or a temporary issue between your network
338- connectivity and AWS.</ p >
387+ < p class =""> It caused in reality by a proxy or a temporary issue between your network connectivity and AWS.</ p >
339388</ div >
340389</ div >
341390</ div >
0 commit comments