Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix create to accept aws parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
neillturner committed Apr 28, 2016
1 parent 45d0344 commit 0f4e2f7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion knife-cfn.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
44 changes: 42 additions & 2 deletions lib/chef/knife/cfn_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class CfnCreate < Chef::Knife::CfnBase
banner "knife cfn create <stack name> (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(',') }

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,
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/knife-cfn/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module KnifeCfn
VERSION = "0.1.10"
VERSION = "0.1.12"
end

0 comments on commit 0f4e2f7

Please sign in to comment.