Class: TerraspacePluginAws::Interfaces::Helper::Secret
- Inherits:
-
SecretBase
- Object
- SecretBase
- TerraspacePluginAws::Interfaces::Helper::Secret
- Defined in:
- lib/terraspace_plugin_aws/interfaces/helper/secret.rb
Instance Method Summary collapse
Methods inherited from SecretBase
Methods included from Logging
Methods included from Clients
#dynamodb, #s3, #secretsmanager, #ssm, #sts
Constructor Details
This class inherits a constructor from TerraspacePluginAws::Interfaces::Helper::SecretBase
Instance Method Details
#fetch(secret_id) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/terraspace_plugin_aws/interfaces/helper/secret.rb', line 3 def fetch(secret_id) secret_id = expansion(secret_id) if value = fetch_value(secret_id) value = Base64.strict_encode64(value).strip if @base64 value end |
#fetch_value(secret_id) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/terraspace_plugin_aws/interfaces/helper/secret.rb', line 10 def fetch_value(secret_id) secret_value = secretsmanager.get_secret_value(secret_id: secret_id) secret_value.secret_string rescue Aws::SecretsManager::Errors::ResourceNotFoundException => e logger.info "WARN: secret_id #{secret_id} not found".color(:yellow) logger.info e. "NOT FOUND #{secret_id}" # simple string so Kubernetes YAML is valid rescue Aws::SecretsManager::Errors::ValidationException => e logger.info "WARN: secret_id #{secret_id} not found".color(:yellow) logger.info e. "INVALID NAME #{secret_id}" # simple string so tfvars valid end |