lib/terraforming/cli.rb in terraforming-0.9.1 vs lib/terraforming/cli.rb in terraforming-0.10.0

- old
+ new

@@ -3,10 +3,13 @@ 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" class_option :region, type: :string, desc: "AWS region" + class_option :use_bundled_cert, + type: :boolean, + desc: "Use the bundled CA certificate from AWS SDK" desc "asg", "AutoScaling Group" def asg execute(Terraforming::Resource::AutoScalingGroup, options) end @@ -74,11 +77,11 @@ desc "iamp", "IAM Policy" def iamp execute(Terraforming::Resource::IAMPolicy, options) end - desc "iamp", "IAM Policy Attachment" + desc "iampa", "IAM Policy Attachment" def iampa execute(Terraforming::Resource::IAMPolicyAttachment, options) end desc "iamr", "IAM Role" @@ -114,10 +117,15 @@ desc "nacl", "Network ACL" def nacl execute(Terraforming::Resource::NetworkACL, options) end + desc "nat", "NAT Gateway" + def nat + execute(Terraforming::Resource::NATGateway, options) + end + desc "nif", "Network Interface" def nif execute(Terraforming::Resource::NetworkInterface, options) end @@ -179,15 +187,19 @@ desc "vgw", "VPN Gateway" def vgw execute(Terraforming::Resource::VPNGateway, options) end - private - def execute(klass, options) + def configure_aws(options) Aws.config[:credentials] = Aws::SharedCredentials.new(profile_name: options[:profile]) if options[:profile] Aws.config[:region] = options[:region] if options[:region] + Aws.use_bundled_cert! if options[:use_bundled_cert] + end + + def execute(klass, options) + configure_aws(options) 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)