Class: TerraformWrapper::Shared::Auths::Azure
- Includes:
- Logging
- Defined in:
- lib/terraform-wrapper/shared/auths/azure.rb
Constant Summary collapse
- @@az =
"az"
- @@type =
"azure"
Instance Method Summary collapse
- #auth ⇒ Object
- #clear ⇒ Object
-
#initialize(options:, variables:) ⇒ Azure
constructor
A new instance of Azure.
Methods included from Logging
configure_logger_for, logger_for
Methods inherited from Common
Constructor Details
#initialize(options:, variables:) ⇒ Azure
Returns a new instance of Azure.
38 39 40 |
# File 'lib/terraform-wrapper/shared/auths/azure.rb', line 38 def initialize(options:, variables:) construct(options: , variables: variables) end |
Instance Method Details
#auth ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/terraform-wrapper/shared/auths/azure.rb', line 44 def auth() details = subscription_details(subscription: @subscription) subscription = details["id"] tenant = details["tenant"] username = @keyvault.nil? ? nil : secret(vault: @keyvault, name: @secret_username) password = @keyvault.nil? ? nil : secret(vault: @keyvault, name: @secret_password) ENV["ARM_SUBSCRIPTION_ID"] = subscription ENV["ARM_TENANT_ID"] = tenant ENV["ARM_CLIENT_ID"] = username unless username.nil? ENV["ARM_CLIENT_SECRET"] = password unless password.nil? logger.success("Azure authenticator environment variables set!") end |
#clear ⇒ Object
61 62 63 64 65 |
# File 'lib/terraform-wrapper/shared/auths/azure.rb', line 61 def clear() ENV.delete("ARM_SUBSCRIPTION_ID") ENV.delete("ARM_TENANT_ID") logger.info("Azure authenticator environment variables cleared!") end |