From 0f4e2f770526d46c7eca82860100fff1103de90d Mon Sep 17 00:00:00 2001 From: neillturner Date: Thu, 28 Apr 2016 15:43:43 +0100 Subject: [PATCH] fix create to accept aws parameters --- knife-cfn.gemspec | 2 +- lib/chef/knife/cfn_create.rb | 44 ++++++++++++++++++++++++++++++++++-- lib/knife-cfn/version.rb | 2 +- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/knife-cfn.gemspec b/knife-cfn.gemspec index 3eeb066..35bb616 100644 --- a/knife-cfn.gemspec +++ b/knife-cfn.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = "knife-cfn" - s.version = "0.1.11" + s.version = "0.0.12" s.summary = "CloudFormation Support for Knife" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.author = "Neill Turner" diff --git a/lib/chef/knife/cfn_create.rb b/lib/chef/knife/cfn_create.rb index a20a92a..8acc050 100644 --- a/lib/chef/knife/cfn_create.rb +++ b/lib/chef/knife/cfn_create.rb @@ -30,7 +30,7 @@ class CfnCreate < Chef::Knife::CfnBase banner "knife cfn create (options)" option :capabilities, - :short => "-C CAPABILITY..", + :short => "-c CAPABILITY..", :long => "--capabilities CAPABILITY1,CAPABILITY2,CAPABILITY3..", :description => "The explicitly approved capabilities that may be used during this stack creation", :proc => Proc.new { |capabilities| capabilities.split(',') } @@ -38,7 +38,7 @@ class CfnCreate < Chef::Knife::CfnBase option :disable_rollback, :short => "-d", :long => "--disable-rollback", - :description => "Flag to disable rollback of created resources when failures are encountered during stack creation. The default value is 'false'", + :description => "Flag to disable rollback of created resources when failures are encountered. The default value is 'false'", :proc => Proc.new { |d| Chef::Config[:knife][:disable_rollback] = "true" } option :template_file, @@ -71,6 +71,46 @@ class CfnCreate < Chef::Knife::CfnBase :description => "Path of the URL that contains the template. This must be a reference to a template in an S3 bucket in the same region that the stack will be created in", :proc => Proc.new { |u| Chef::Config[:knife][:template_url] = u } + option :aws_credential_file, + :long => "--aws-credential-file FILE", + :description => "File containing AWS credentials as used by aws cmdline tools", + :proc => Proc.new { |key| Chef::Config[:knife][:aws_credential_file] = key } + + option :aws_profile, + :long => "--aws-profile PROFILE", + :description => "AWS profile, from credential file, to use", + :default => 'default', + :proc => Proc.new { |key| Chef::Config[:knife][:aws_profile] = key } + + option :aws_access_key_id, + :short => "-A ID", + :long => "--aws-access-key-id KEY", + :description => "Your AWS Access Key ID", + :proc => Proc.new { |key| Chef::Config[:knife][:aws_access_key_id] = key } + + option :aws_secret_access_key, + :short => "-K SECRET", + :long => "--aws-secret-access-key SECRET", + :description => "Your AWS API Secret Access Key", + :proc => Proc.new { |key| Chef::Config[:knife][:aws_secret_access_key] = key } + + option :aws_session_token, + :long => "--aws-session-token TOKEN", + :description => "Your AWS Session Token, for use with AWS STS Federation or Session Tokens", + :proc => Proc.new { |key| Chef::Config[:knife][:aws_session_token] = key } + + option :region, + :long => "--region REGION", + :description => "Your AWS region", + :proc => Proc.new { |key| Chef::Config[:knife][:region] = key } + + option :use_iam_profile, + :long => "--use-iam-profile", + :description => "Use IAM profile assigned to current machine", + :boolean => true, + :default => false, + :proc => Proc.new { |key| Chef::Config[:knife][:use_iam_profile] = key } + def run $stdout.sync = true diff --git a/lib/knife-cfn/version.rb b/lib/knife-cfn/version.rb index 6af1286..7bfb193 100644 --- a/lib/knife-cfn/version.rb +++ b/lib/knife-cfn/version.rb @@ -1,3 +1,3 @@ module KnifeCfn - VERSION = "0.1.10" + VERSION = "0.1.12" end