Sha256: e154118cd7a5d1293968f62d42ec09b1f253cbfd773456d72174ed2a4f6ab8e9
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module Terraformer class CLI < Thor class_option :merge, type: :string, desc: "tfstate file to merge" class_option :name, type: :string, desc: "name of the tf file" class_option :aws_access_key_id, type: :string, desc: "aws access key" class_option :aws_secret_access_key, type: :string, desc: "aws access key" class_option :aws_region, type: :string, desc: "aws region" class_option :datadog_api_key, type: :string, desc: "datadog api key" class_option :datadog_app_key, type: :string, desc: "datadog app key" desc "cwa", "CloudWatch Alarm" def cwa execute(Terraformer::Resource::CloudWatchAlarm, options) end desc "dm", "Datadog Monitor" def dm execute(Terraformer::Resource::DatadogMonitor, options) end private def symbolize(obj) return obj.reduce({}) do |memo, (k, v)| memo.tap { |m| m[k.to_sym] = symbolize(v) } end if obj.is_a? Hash return obj.reduce([]) do |memo, v| memo << symbolize(v); memo end if obj.is_a? Array obj end def execute(klass, options) klass_name = klass.name options = symbolize(options) response = klass.execute(options) Terraformer::Terraform.execute(response, klass_name, options) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
terraform-exporter-0.0.4 | lib/terraformer/cli.rb |
terraform-exporter-0.0.3 | lib/terraformer/cli.rb |