terraspace_plugin_aws 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c20f17d758fbb6924ceece1c1bbc16ec17e3eba0fa8a0a6fa4d644b9875579b6
4
- data.tar.gz: 73b7f625a5f84f7252206717523807c7607ac4a4fe6f6572cfd01e7110641b38
3
+ metadata.gz: cdced79235a57025ab37b33dbdf98d9146caffaa4f3eac5f40b2a657a99ea3ca
4
+ data.tar.gz: 154369a87b3ffb7fb8290a4b3564108b976e1f7826b0f36fa737b88050e4755c
5
5
  SHA512:
6
- metadata.gz: 39978c0db0055dba8dc59246b9da3dd20c469daf36805526f4b2c0c051425dd6dbf0be054812de9e7ae0c32b31657222225ae039915ddc3ef11aab657d9adbb9
7
- data.tar.gz: ff11fee1dec2508d941dacd4f727ad362802285aca20ac2b0aa9cc87a034e0d287f9f10db3816e330958025e608fdeff45720b543047f1d3fe5fe52f5f305fb1
6
+ metadata.gz: 42ebf3fabea658ddb1876aaefa972888e2d2b958239eed92ad9ad9dd3a4d23dea83d67beefbdce28512585a3ceecdb7f904dc08ce8ce87859dcd3e354ada313e
7
+ data.tar.gz: 84c6a6dc52b9f645f5dab2ab1284eccca1d152034106b4a694f42294149d441aaa5bffc0e67cc37e17c5d990758396dadef0761617a3a606372ecc25954d5ea3
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [0.3.6] - 2022-01-04
7
+ - [#17](https://github.com/boltops-tools/terraspace_plugin_aws/pull/17) aws_secret and aws_ssm: support expansion automatically
8
+
6
9
  ## [0.3.5] - 2021-12-30
7
10
  - [#15](https://github.com/boltops-tools/terraspace_plugin_aws/pull/15) block public access support
8
11
  - [#16](https://github.com/boltops-tools/terraspace_plugin_aws/pull/16) tagging support for s3 bucket and dynamodb table
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Terraspace AWS Plugin
2
2
 
3
+ [![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
4
+
3
5
  AWS Cloud support for terraspace.
4
6
 
5
7
  ## Installation
@@ -12,6 +14,8 @@ gem 'terraspace_plugin_aws'
12
14
 
13
15
  ## Configure
14
16
 
17
+ Terraspace Docs: [AWS Terraspace Plugin](https://terraspace.cloud/docs/plugins/aws/)
18
+
15
19
  Optionally configure the plugin. Here's an example `aws.rb` for your terraspace project.
16
20
 
17
21
  config/plugins/aws.rb
@@ -1,6 +1,7 @@
1
1
  module TerraspacePluginAws::Interfaces::Helper
2
2
  class Secret < SecretBase
3
3
  def fetch(secret_id)
4
+ secret_id = expansion(secret_id) if expand?
4
5
  value = fetch_value(secret_id)
5
6
  value = Base64.strict_encode64(value).strip if @base64
6
7
  value
@@ -13,6 +14,10 @@ module TerraspacePluginAws::Interfaces::Helper
13
14
  logger.info "WARN: secret_id #{secret_id} not found".color(:yellow)
14
15
  logger.info e.message
15
16
  "NOT FOUND #{secret_id}" # simple string so Kubernetes YAML is valid
17
+ rescue Aws::SecretsManager::Errors::ValidationException => e
18
+ logger.info "WARN: secret_id #{secret_id} not found".color(:yellow)
19
+ logger.info e.message
20
+ "INVALID NAME #{secret_id}" # simple string so tfvars valid
16
21
  end
17
22
  end
18
23
  end
@@ -4,10 +4,23 @@ module TerraspacePluginAws::Interfaces::Helper
4
4
  class SecretBase
5
5
  include TerraspacePluginAws::Clients
6
6
  include TerraspacePluginAws::Logging
7
+ extend Memoist
7
8
 
8
- def initialize(options={})
9
+ def initialize(mod, options={})
10
+ @mod = mod
9
11
  @options = options
10
12
  @base64 = options[:base64]
11
13
  end
14
+
15
+ private
16
+ delegate :expansion, to: :expander
17
+ def expander
18
+ TerraspacePluginAws::Interfaces::Expander.new(@mod)
19
+ end
20
+ memoize :expander
21
+
22
+ def expand?
23
+ !(@options[:expansion] == false || @options[:expand] == false)
24
+ end
12
25
  end
13
26
  end
@@ -1,6 +1,10 @@
1
1
  module TerraspacePluginAws::Interfaces::Helper
2
2
  class SSM < SecretBase
3
+ include Terraspace::Compiler::Dsl::Syntax::Mod::Backend
4
+ extend Memoist
5
+
3
6
  def fetch(name)
7
+ name = expansion(name) if expand?
4
8
  value = fetch_value(name)
5
9
  value = Base64.strict_encode64(value).strip if @base64
6
10
  value
@@ -13,6 +17,10 @@ module TerraspacePluginAws::Interfaces::Helper
13
17
  logger.info "WARN: name #{name} not found".color(:yellow)
14
18
  logger.info e.message
15
19
  "NOT FOUND #{name}" # simple string so tfvars valid
20
+ rescue Aws::SSM::Errors::ValidationException => e
21
+ logger.info "WARN: name #{name} not found".color(:yellow)
22
+ logger.info e.message
23
+ "INVALID NAME #{name}" # simple string so tfvars valid
16
24
  end
17
25
  end
18
26
  end
@@ -3,12 +3,12 @@ module TerraspacePluginAws::Interfaces
3
3
  include Terraspace::Plugin::Helper::Interface
4
4
 
5
5
  def aws_secret(name, options={})
6
- Secret.new(options).fetch(name)
6
+ Secret.new(@mod, options).fetch(name)
7
7
  end
8
8
  cache_helper :aws_secret
9
9
 
10
10
  def aws_ssm(name, options={})
11
- SSM.new(options).fetch(name)
11
+ SSM.new(@mod, options).fetch(name)
12
12
  end
13
13
  cache_helper :aws_ssm
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module TerraspacePluginAws
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace_plugin_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-30 00:00:00.000000000 Z
11
+ date: 2022-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb