Created
April 17, 2015 14:57
-
-
Save techshell/54dee1bebdd7104119c2 to your computer and use it in GitHub Desktop.
knife.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'IniFile' | |
aws_profile = 'hatim' | |
knife[:aws_access_key_id] = IniFile.load(File.join(File.expand_path('~'), '.aws', 'credentials'))["#{aws_profile}"]['aws_access_key_id'] | |
knife[:aws_secret_access_key] = IniFile.load(File.join(File.expand_path('~'), '.aws', 'credentials'))["#{aws_profile}"]['aws_secret_access_key'] | |
knife[:aws_region] = IniFile.load(File.join(File.expand_path('~'), '.aws', 'config'))["profile #{aws_profile}"]['region'] | |
[:cloudformation, :options].inject(knife){ |m,k| m[k] ||= Mash.new } | |
knife[:cloudformation][:options][:disable_rollback] = false | |
knife[:cloudformation][:options][:capabilities] = ['CAPABILITY_IAM'] | |
knife[:cloudformation][:processing] = true | |
knife[:cloudformation][:credentials] = { | |
:aws_region => knife[:aws_region], | |
:aws_access_key_id => knife[:aws_access_key_id], | |
:aws_secret_access_key => knife[:aws_secret_access_key] | |
} | |
# If you are using nested stacks add bucket to store templates. Note | |
# that the bucket must exist (the library will not auto-create it) | |
knife[:cloudformation][:nesting_bucket] = 'my-cfn-nested-stacks' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment