lib/terraforming/cli.rb in terraforming-0.3.2 vs lib/terraforming/cli.rb in terraforming-0.4.0

- old
+ new

@@ -1,11 +1,17 @@ module Terraforming class CLI < Thor class_option :merge, type: :string, desc: "tfstate file to merge" class_option :overwrite, type: :boolean, desc: "Overwrite existng tfstate" class_option :tfstate, type: :boolean, desc: "Generate tfstate" + class_option :profile, type: :string, desc: "AWS credentials profile" + desc "asg", "AutoScaling Group" + def asg + execute(Terraforming::Resource::AutoScalingGroup, options) + end + desc "dbpg", "Database Parameter Group" def dbpg execute(Terraforming::Resource::DBParameterGroup, options) end @@ -135,9 +141,10 @@ end private def execute(klass, options) + Aws.config[:credentials] = Aws::SharedCredentials.new(profile_name: options[:profile]) if options[:profile] result = options[:tfstate] ? tfstate(klass, options[:merge]) : tf(klass) if options[:tfstate] && options[:merge] && options[:overwrite] open(options[:merge], "w+") do |f| f.write(result)