Skip to content

Commit

Permalink
Merge pull request #11 from boltops-tools/google-cloud-project-env-var
Browse files Browse the repository at this point in the history
set GOOGLE_CLOUD_PROJECT while keeping backwards compatibility
  • Loading branch information
tongueroo authored Jan 11, 2022
2 parents 1e48474 + 61296de commit 6e8cfac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/terraspace_plugin_google/clients.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ module TerraspacePluginGoogle
module Clients
extend Memoist

def initialize(*)
# So google sdk newer versions use GOOGLE_CLOUD_PROJECT instead of GOOGLE_PROJECT
# Found out between google-cloud-storage-1.35.0 and google-cloud-storage-1.28.0
# Though it seems like an library underneath that with the change.
# Keeping backwards compatibility to not create breakage users who already have GOOGLE_PROJECT
# But then setting GOOGLE_CLOUD_PROJECT so it works with the SDK.
# For users, who set GOOGLE_CLOUD_PROJECT that will work also.
ENV['GOOGLE_CLOUD_PROJECT'] ||= ENV['GOOGLE_PROJECT']
super
end

def secret_manager_service
Google::Cloud::SecretManager.secret_manager_service
end
Expand Down

0 comments on commit 6e8cfac

Please sign in to comment.