Skip to content

Commit 61296de

Browse files
committed
set GOOGLE_CLOUD_PROJECT while keeping backwards compatibility
1 parent 1e48474 commit 61296de

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/terraspace_plugin_google/clients.rb

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ module TerraspacePluginGoogle
66
module Clients
77
extend Memoist
88

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+
920
def secret_manager_service
1021
Google::Cloud::SecretManager.secret_manager_service
1122
end

0 commit comments

Comments
 (0)