Sha256: 244c72ff06ed6e3cc390320b6a0137f02f6905172532209b7fd39af0120a3904
Contents?: true
Size: 813 Bytes
Versions: 2
Compression:
Stored size: 813 Bytes
Contents
#!/usr/bin/env ruby require "bundler/setup" require "json" require_relative "../lib/terraform_template_renderer" def help puts <<~EOF Usage: render-template <path_to_erb_template> Reads json blob with params from STDIN EOF end if ARGV.empty? STDERR.puts "You must supply the path to an ERB template as the first argument" exit 1 end template_path = ARGV[0] if ["-h", "--help", "-help", "help"].include?(template_path) help exit 0 end unless File.exist?(template_path) STDERR.puts "ERB Template #{template_path} does not exist" exit 2 end template = File.read(template_path) json_params = STDIN.read renderer = TerraformTemplateRenderer::Renderer.new(template) rendered_template = renderer.render(json_params) json_output = { rendered: rendered_template }.to_json puts json_output
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
terraform-template-renderer-0.2.0 | exe/render-template |
terraform-template-renderer-0.1.0 | exe/render-template |