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:
Jason Witkowski 2020-10-26 18:28:32 -04:00 committed by GitHub
parent d8dc45f03f
commit ebfaa551eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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),

View File

@ -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