terraspace_plugin_google 0.3.1 → 0.3.5
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 +12 -0
- data/lib/templates/hcl/module/main.tf +1 -0
- data/lib/templates/hcl/module/variables.tf +6 -0
- data/lib/templates/hcl/stack/main.tf +1 -0
- data/lib/templates/hcl/stack/variables.tf +6 -0
- data/lib/terraspace_plugin_google/clients.rb +11 -0
- data/lib/terraspace_plugin_google/interfaces/helper/secret.rb +26 -3
- data/lib/terraspace_plugin_google/interfaces/helper.rb +1 -1
- data/lib/terraspace_plugin_google/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d49aa4dec651de8b67872942c9f237b38e123263985f6d6d18151b46ffe14b5
|
4
|
+
data.tar.gz: '04508bd3f5f2336e0d2bf3cb99943809961e0d5807eef3afbdbf311e769540ee'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fb9e68077f452fdbb96d00ebdcaac6b67bed251752c4c388be97cfb9e48568f48d73b4a02ee7d1293e3872bbbbc7d4e400bbfa2135c88a5b54f3b9a90eb6c99
|
7
|
+
data.tar.gz: da5a5b2f44d20182d9ea0916f144f8b0703b2f4d774bbc9658af8078ccf802cd0251eaf4f7515b46c4f3974af1eb4b297135ff5b671171769996e36e1d52ca3b
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
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.5] - 2022-01-11
|
7
|
+
- [#11](https://github.com/boltops-tools/terraspace_provider_google/pull/11) set GOOGLE_CLOUD_PROJECT while keeping backwards compatibility
|
8
|
+
|
9
|
+
## [0.3.4] - 2022-01-11
|
10
|
+
- [#10](https://github.com/boltops-tools/terraspace_provider_google/pull/10) set GOOGLE_CLOUD_PROJECT while keeping backwards compatibility
|
11
|
+
|
12
|
+
## [0.3.3] - 2022-01-04
|
13
|
+
- [#9](https://github.com/boltops-tools/terraspace_provider_google/pull/9) google_secret support expansion automatically
|
14
|
+
|
15
|
+
## [0.3.2] - 2021-11-25
|
16
|
+
- [#8](https://github.com/boltops-tools/terraspace_provider_google/pull/8) update example templates to include bucket location which is now required
|
17
|
+
|
6
18
|
## [0.3.1] - 2021-11-13
|
7
19
|
- [#7](https://github.com/boltops-tools/terraspace_provider_google/pull/7) get google project number via api
|
8
20
|
|
@@ -6,6 +6,17 @@ module TerraspacePluginGoogle
|
|
6
6
|
module Clients
|
7
7
|
extend Memoist
|
8
8
|
|
9
|
+
def initialize(*)
|
10
|
+
# So google sdk newer versions use GOOGLE_CLOUD_PROJECT instead of GOOGLE_PROJECT
|
11
|
+
# Found out between google-cloud-storage-1.35.0 and google-cloud-storage-1.28.0
|
12
|
+
# Though it seems like an library underneath that with the change.
|
13
|
+
# Keeping backwards compatibility to not create breakage users who already have GOOGLE_PROJECT
|
14
|
+
# But then setting GOOGLE_CLOUD_PROJECT so it works with the SDK.
|
15
|
+
# For users, who set GOOGLE_CLOUD_PROJECT that will work also.
|
16
|
+
ENV['GOOGLE_CLOUD_PROJECT'] ||= ENV['GOOGLE_PROJECT']
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
9
20
|
def secret_manager_service
|
10
21
|
Google::Cloud::SecretManager.secret_manager_service
|
11
22
|
end
|
@@ -4,11 +4,19 @@ module TerraspacePluginGoogle::Interfaces::Helper
|
|
4
4
|
class Secret
|
5
5
|
include TerraspacePluginGoogle::Clients
|
6
6
|
include TerraspacePluginGoogle::Logging
|
7
|
+
extend Memoist
|
7
8
|
|
8
|
-
def initialize(options={})
|
9
|
-
@options = options
|
9
|
+
def initialize(mod, options={})
|
10
|
+
@mod, @options = mod, options
|
10
11
|
@base64 = options[:base64]
|
11
|
-
@project_id = options[:google_project] || ENV['GOOGLE_PROJECT'] || raise("GOOGLE_PROJECT env variable is not set. It's required.")
|
12
|
+
@project_id = options[:google_project] || ENV['GOOGLE_CLOUD_PROJECT'] || ENV['GOOGLE_PROJECT'] || raise("GOOGLE_PROJECT env variable is not set. It's required.")
|
13
|
+
# So google sdk newer versions use GOOGLE_CLOUD_PROJECT instead of GOOGLE_PROJECT
|
14
|
+
# Found out between google-cloud-storage-1.35.0 and google-cloud-storage-1.28.0
|
15
|
+
# Though it seems like an library underneath that with the change.
|
16
|
+
# Keeping backwards compatibility to not create breakage users who already have GOOGLE_PROJECT
|
17
|
+
# But then setting GOOGLE_CLOUD_PROJECT so it works with the SDK.
|
18
|
+
# For users, who set GOOGLE_CLOUD_PROJECT that will work also.
|
19
|
+
ENV['GOOGLE_CLOUD_PROJECT'] ||= @project_id
|
12
20
|
end
|
13
21
|
|
14
22
|
def fetch(short_name, version: "latest")
|
@@ -18,6 +26,7 @@ module TerraspacePluginGoogle::Interfaces::Helper
|
|
18
26
|
end
|
19
27
|
|
20
28
|
def fetch_value(short_name, version="latest")
|
29
|
+
short_name = expansion(short_name) if expand?
|
21
30
|
name = "projects/#{project_number}/secrets/#{short_name}/versions/#{version}"
|
22
31
|
version = secret_manager_service.access_secret_version(name: name)
|
23
32
|
version.payload.data
|
@@ -25,6 +34,10 @@ module TerraspacePluginGoogle::Interfaces::Helper
|
|
25
34
|
logger.info "WARN: secret #{name} not found".color(:yellow)
|
26
35
|
logger.info e.message
|
27
36
|
"NOT FOUND #{name}" # simple string so Kubernetes YAML is valid
|
37
|
+
rescue Google::Cloud::InvalidArgumentError => e
|
38
|
+
logger.info "WARN: secret #{name} not found".color(:yellow)
|
39
|
+
logger.info e.message
|
40
|
+
"NOT FOUND #{name}" # simple string so Kubernetes YAML is valid
|
28
41
|
end
|
29
42
|
|
30
43
|
private
|
@@ -34,5 +47,15 @@ module TerraspacePluginGoogle::Interfaces::Helper
|
|
34
47
|
project = resource_manager.project(@project_id)
|
35
48
|
@@project_number = project.project_number
|
36
49
|
end
|
50
|
+
|
51
|
+
delegate :expansion, to: :expander
|
52
|
+
def expander
|
53
|
+
TerraspacePluginGoogle::Interfaces::Expander.new(@mod)
|
54
|
+
end
|
55
|
+
memoize :expander
|
56
|
+
|
57
|
+
def expand?
|
58
|
+
!(@options[:expansion] == false || @options[:expand] == false)
|
59
|
+
end
|
37
60
|
end
|
38
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace_plugin_google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gcp_data
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
172
|
+
rubygems_version: 3.2.32
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Terraspace Google Cloud Plugin
|