cloudformation-tool 1.5.8 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -2
- data/lib/cloud_formation_tool/version.rb +1 -1
- data/lib/cloud_formation_tool.rb +22 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b64f38328ec8d1843260e00ec3caf036ed3dff604d013a127df99fe741cf7b61
|
4
|
+
data.tar.gz: 3475cfcaaa53b64528c558f8a1eaf79795e676516db8018811503c9646047dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5fe56f25e0f6d1a4c1a7725cd5b22c9fb9d01591be43eea7a95512b8abd8f835ba9034987b96d6126f13b8a16ddd4a9983e3d4e2084e2163fbb3fd86966b0ec
|
7
|
+
data.tar.gz: 12cb69dd1a9fe9dfcf238aeafab0d1191c4ef1c71b66aac553fd3f5bb54979cf0ba3de03f9dcf5e1fdb0cee81dece373e7a1a4bdd5b36a616e5328263653ad36
|
data/README.md
CHANGED
@@ -359,11 +359,23 @@ more details and specific options.
|
|
359
359
|
|
360
360
|
### Region Selection
|
361
361
|
|
362
|
-
The
|
362
|
+
The CloudFormation tool must know what region the CloudFormation stack is being deployed into, so it
|
363
|
+
can create and appropriately located S3 bucket for template intermediary files (such cloud-init templates).
|
364
|
+
|
365
|
+
The AWS region will be chosen according to this order of precedence:
|
366
|
+
- Using the top level command line option `--region`
|
367
|
+
- Setting the environment variable `AWS_REGION` (to be compatible with the AWS CLI)
|
368
|
+
- Setting a default region in the AWS CLI profile, then selecting that profile using the top level command
|
369
|
+
line option `--profile` (this can be done using `aws configure` or by editing the credentials file)
|
370
|
+
- Setting the environment variable `AWS_DEFAULT_REGION`
|
371
|
+
- If none of these are set, the default AWS region `us-east-1` is assumed
|
363
372
|
|
364
373
|
### Credentials Selection
|
365
374
|
|
366
|
-
The tool will use the standard AWS credentials selection process, except
|
375
|
+
The tool will use the standard AWS credentials selection process, except that you may want to use AWS CLI configured
|
376
|
+
credential profile - you may select to use a profile other than "default" either by using the top level command line
|
377
|
+
option `--profile`, by providing the standard environment variable `AWS_DEFAULT_PROFILE`, or by creating a file called
|
378
|
+
`.awsprofile` - whose content is the name of a valid AWS credentials profile - in a parent directory (at any level up to the root directory).
|
367
379
|
|
368
380
|
## Library API
|
369
381
|
|
data/lib/cloud_formation_tool.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'autoloaded'
|
3
|
+
require 'socket'
|
4
|
+
require 'aws-sdk-core'
|
3
5
|
|
4
6
|
def logger
|
5
7
|
($__logger ||= Logger.new(STDERR))
|
@@ -37,6 +39,22 @@ def error(message = nul, &block)
|
|
37
39
|
end)
|
38
40
|
end
|
39
41
|
|
42
|
+
# Hack AWS SDK to let us find out the Profile's region that it resolved
|
43
|
+
module Aws
|
44
|
+
class SharedConfig
|
45
|
+
def profile_region
|
46
|
+
c = (if @parsed_credentials and @parsed_credentials[@profile_name] then
|
47
|
+
@parsed_credentials[@profile_name]
|
48
|
+
elsif @parsed_config and @parsed_config[@profile_name] then
|
49
|
+
@parsed_config[@profile_name]
|
50
|
+
else
|
51
|
+
{}
|
52
|
+
end)
|
53
|
+
c['region'] || c['aws_region'] || c['sso_region'] || nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
40
58
|
module CloudFormationTool
|
41
59
|
|
42
60
|
Autoloaded.module do |autoloaded|
|
@@ -54,7 +72,10 @@ module CloudFormationTool
|
|
54
72
|
end
|
55
73
|
|
56
74
|
def region
|
57
|
-
$__region ||=
|
75
|
+
$__region ||= ENV['AWS_REGION'] ||
|
76
|
+
Aws::SharedConfig.new(profile_name: profile, config_enabled: true).profile_region ||
|
77
|
+
ENV['AWS_DEFAULT_REGION'] ||
|
78
|
+
'us-east-1'
|
58
79
|
end
|
59
80
|
|
60
81
|
def profile name = nil
|
@@ -62,7 +83,6 @@ module CloudFormationTool
|
|
62
83
|
end
|
63
84
|
|
64
85
|
def awscreds
|
65
|
-
require 'aws-sdk-core'
|
66
86
|
#$__aws_creds ||= Aws::SharedCredentials.new(profile_name: profile)
|
67
87
|
config = Aws::SharedConfig.new(profile_name: profile, config_enabled: true)
|
68
88
|
$__aws_creds ||= config.credentials
|