aws-cft-tools 0.1.2 → 0.1.3
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/CHANGELOG.md +11 -0
- data/lib/aws_cft_tools/template.rb +9 -3
- data/lib/aws_cft_tools/template/metadata.rb +8 -2
- data/lib/aws_cft_tools/template/properties.rb +8 -1
- data/lib/aws_cft_tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf914a7a3004e1abd739897b4d1b91b65119c92a
|
|
4
|
+
data.tar.gz: c84ce2a9eeba3748c36b41833961c1645be38932
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 211496b26c6170e2c6ab5fab09947c3eecece848e811fe975dcbf0bb0ce0f3603bfe397ad6aa39c7f44a9a63655e407d14a909afc31e416fbf9ba28c45b5e23c
|
|
7
|
+
data.tar.gz: f9628f83d7e26613dfd8e7af0b513aff118287e0af11afae8436726b946c938101eae7488bb6da19d0d167eb06aa4d426a9e8a8c24eb0b66719539bfa53335c3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.3] - 2018-01-05
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
* Support for `AllowedPattern` in the `Environment` template parameter. (Issue #16)
|
|
8
|
+
|
|
9
|
+
* Support for parameter files to have environment names that resemble regular expressions. If the parameter
|
|
10
|
+
file doesn't have a key that matches the environment name exactly, then each of the top-level keys in the
|
|
11
|
+
file will be interpreted as a regular expression and matched against the environment being deployed. The
|
|
12
|
+
first match wins, so if multiple keys can match, then the result is undefined. (Issue #16)
|
|
13
|
+
|
|
3
14
|
## [0.1.2] - 2017-12-22
|
|
4
15
|
|
|
5
16
|
### Changed
|
|
@@ -24,10 +24,10 @@ module AwsCftTools
|
|
|
24
24
|
#
|
|
25
25
|
# === Allowed Environments
|
|
26
26
|
#
|
|
27
|
-
# The environments in which a template should be deployed is provided by the +AllowedValues+
|
|
28
|
-
# +Environment+ template parameter.
|
|
27
|
+
# The environments in which a template should be deployed is provided by the +AllowedValues+ or the
|
|
28
|
+
# +AllowedPattern+ key of the +Environment+ template parameter.
|
|
29
29
|
#
|
|
30
|
-
# @example Allowed Environments
|
|
30
|
+
# @example Allowed Environments (explicit list)
|
|
31
31
|
# ---
|
|
32
32
|
# Parameters:
|
|
33
33
|
# Environment:
|
|
@@ -36,6 +36,12 @@ module AwsCftTools
|
|
|
36
36
|
# - Staging
|
|
37
37
|
# - Production
|
|
38
38
|
#
|
|
39
|
+
# @example Allowed Environments (implicit pattern)
|
|
40
|
+
# ---
|
|
41
|
+
# Parameters:
|
|
42
|
+
# Environment:
|
|
43
|
+
# AllowedPattern: ^(QA|Staging|Production|Dev-.+)$
|
|
44
|
+
#
|
|
39
45
|
# === Allowed Regions
|
|
40
46
|
#
|
|
41
47
|
# A template can be pinned to a particular region or set of regions by providing a list of values for
|
|
@@ -114,8 +114,14 @@ module AwsCftTools
|
|
|
114
114
|
def parameters_for_filename_and_environment!(param_source, env)
|
|
115
115
|
return { Environment: env } unless param_source
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
params_for_all = YAML.safe_load(process_erb_file(param_source), [], [], true)
|
|
118
|
+
return params_for_all[env].update('Environment' => env) if params_for_all.key?(env)
|
|
119
|
+
|
|
120
|
+
# now check for regex match on keys
|
|
121
|
+
params_for_all.each do |env_name, params|
|
|
122
|
+
return params.update('Environment' => env) if Regexp.compile("\\A#{env_name}\\Z").match?(env)
|
|
123
|
+
end
|
|
124
|
+
{ 'Environment' => env }
|
|
119
125
|
end
|
|
120
126
|
|
|
121
127
|
def process_erb_file(content)
|
|
@@ -15,8 +15,15 @@ module AwsCftTools
|
|
|
15
15
|
template.dig('Parameters', 'Environment', 'AllowedValues') || []
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def allowed_environments_regex
|
|
19
|
+
source = template.dig('Parameters', 'Environment', 'AllowedPattern')
|
|
20
|
+
Regexp.compile(source) if source
|
|
21
|
+
end
|
|
22
|
+
|
|
18
23
|
def environment?(value)
|
|
19
|
-
allowed_environments.include?(value)
|
|
24
|
+
return allowed_environments.include?(value) if allowed_environments.any?
|
|
25
|
+
regex = allowed_environments_regex
|
|
26
|
+
return regex.match?(value) if regex
|
|
20
27
|
end
|
|
21
28
|
|
|
22
29
|
##
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aws-cft-tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Small Business Administration
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk
|