July 2017
Beginner
208 pages
5h 10m
English
As of Terraform 0.8, there is also an external_data resource. It allows us to call any other program and use the data returned by it, as long as it implements a specific protocol. The main requirement for this program is that it returns a valid JSON as a result of execution. Create the following tiny Ruby script in the root template directory:
require 'json'
data = {
owner: "Packt"
}
puts data.to_json
Now configure external data resource as follows:
data "external" "example" {
program = ["ruby", "${path.module}/custom_data_source.rb"]
}
Finally, use it inside the module to extend its name attribute:
module "mighty_trousers" { source = "./modules/application" ...Read now
Unlock full access