Add ability to specify region for OCI Storage Backend (#9302)
* Add ability to specify region for OCI Storage Backend * Fix capitalization in Vault documentation Co-authored-by: Josh Black <raskchanky@users.noreply.github.com> Co-authored-by: Vishal Nayak <vishalnayak@users.noreply.github.com>
This commit is contained in:
parent
d8dc45f03f
commit
ebfaa551eb
|
@ -63,6 +63,7 @@ var (
|
|||
|
||||
type Backend struct {
|
||||
client *objectstorage.ObjectStorageClient
|
||||
region string
|
||||
bucketName string
|
||||
logger log.Logger
|
||||
permitPool *physical.PermitPool
|
||||
|
@ -72,7 +73,9 @@ type Backend struct {
|
|||
}
|
||||
|
||||
func NewBackend(conf map[string]string, logger log.Logger) (physical.Backend, error) {
|
||||
region := conf["region"]
|
||||
bucketName := conf["bucket_name"]
|
||||
|
||||
if bucketName == "" {
|
||||
return nil, errors.New("missing bucket name")
|
||||
}
|
||||
|
@ -124,8 +127,13 @@ func NewBackend(conf map[string]string, logger log.Logger) (physical.Backend, er
|
|||
return nil, errwrap.Wrapf("failed creating NewObjectStorageClientWithConfigurationProvider: {{err}}", err)
|
||||
}
|
||||
|
||||
if region != "" {
|
||||
objectStorageClient.SetRegion(region)
|
||||
}
|
||||
|
||||
logger.Debug("configuration",
|
||||
"bucket_name", bucketName,
|
||||
"region", region,
|
||||
"namespace_name", namespaceName,
|
||||
"ha_enabled", haEnabled,
|
||||
"lock_bucket_name", lockBucketName,
|
||||
|
@ -134,6 +142,7 @@ func NewBackend(conf map[string]string, logger log.Logger) (physical.Backend, er
|
|||
|
||||
return &Backend{
|
||||
client: &objectStorageClient,
|
||||
region: region,
|
||||
bucketName: bucketName,
|
||||
logger: logger,
|
||||
permitPool: physical.NewPermitPool(MaxNumberOfPermits),
|
||||
|
|
|
@ -17,6 +17,7 @@ The OCI Object Storage backend is used to persist Vault's data in OCI Object Sto
|
|||
|
||||
```hcl
|
||||
storage "oci" {
|
||||
region = "<oci_region>"
|
||||
namespace_name = "<object_storage_namespace_name>"
|
||||
bucket_name = "<vault_data_bucket_name>"
|
||||
ha_enabled = "<boolean true/false>"
|
||||
|
@ -41,9 +42,11 @@ For more information on service accounts, please see the [OCI Identity documenta
|
|||
|
||||
## `oci` Parameters
|
||||
|
||||
- `region` `(string: <optional>)` - Specifies the OCI region where Vault should look for object storage buckets. If not specified the OCI Storage Backend will use the region specified in your OCI credentials configuration.
|
||||
|
||||
- `namespace_name` `(string: <required>)` – Specifies the name of the OCI Object Storage namespaces containing the data bucket and the lock bucket.
|
||||
|
||||
- `bucket_name` `(string: <required>)` - Specifies the name of the bucket that will be used to store the vault data.
|
||||
- `bucket_name` `(string: <required>)` - Specifies the name of the bucket that will be used to store the Vault data.
|
||||
|
||||
### High Availability Parameters
|
||||
|
||||
|
|
Loading…
Reference in New Issue