Skip to content

Commit

Permalink
PLT-1443:Added Backup storage for other providers(Minio, gcp and azure).
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM committed Nov 18, 2024
1 parent 562f443 commit 9c03890
Show file tree
Hide file tree
Showing 6 changed files with 383 additions and 68 deletions.
37 changes: 32 additions & 5 deletions docs/resources/backup_storage_location.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,49 @@ resource "spectrocloud_backup_storage_location" "bsl2" {

### Required

- `bucket_name` (String) The name of the storage bucket where backups are stored. This is relevant for S3 or S3-compatible storage services.
- `is_default` (Boolean) Specifies if this backup storage location should be used as the default location for storing backups.
- `name` (String) The name of the backup storage location. This is a unique identifier for the backup location.
- `region` (String) The region where the backup storage is located, typically corresponding to the region of the cloud provider.
- `s3` (Block List, Min: 1, Max: 1) S3-specific settings for configuring the backup storage location. (see [below for nested schema](#nestedblock--s3))

### Optional

- `ca_cert` (String) An optional CA certificate used for SSL connections to ensure secure communication with the storage provider.
- `azure_storage_config` (Block List, Max: 1) Azure storage settings for configuring the backup storage location. (see [below for nested schema](#nestedblock--azure_storage_config))
- `bucket_name` (String) The name of the storage bucket where backups are stored. This is relevant for S3 or S3-compatible(minio) or gcp storage services.
- `ca_cert` (String) An optional CA certificate used for SSL connections to ensure secure communication with the storage provider. This is relevant for S3 or S3-compatible(minio) storage services.
- `context` (String) The context of the backup storage location. Allowed values are `project` or `tenant`. Default value is `project`. If the `project` context is specified, the project name will sourced from the provider configuration parameter [`project_name`](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs#schema).
- `gcp_storage_config` (Block List, Max: 1) GCP storage settings for configuring the backup storage location. (see [below for nested schema](#nestedblock--gcp_storage_config))
- `is_default` (Boolean) Specifies if this backup storage location should be used as the default location for storing backups.
- `location_provider` (String) The location provider for backup storage location. Allowed values are `aws` or `minio` or `gcp` or `azure`. Default value is `aws`.
- `region` (String) The region where the backup storage is located, typically corresponding to the region of the cloud provider. This is relevant for S3 or S3-compatible(minio) storage services.
- `s3` (Block List, Max: 1) S3-specific settings for configuring the backup storage location. (see [below for nested schema](#nestedblock--s3))
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--azure_storage_config"></a>
### Nested Schema for `azure_storage_config`

Required:

- `azure_client_id` (String) Unique client Id from Azure console.
- `azure_client_secret` (String, Sensitive) Azure secret for authentication.
- `azure_tenant_id` (String) Unique tenant Id from Azure console.
- `container_name` (String) The container name.
- `resource_group` (String) The resource group name.
- `stock_keeping_unit` (String) The stop-keeping unit.
- `storage_name` (String) The storage name.
- `subscription_id` (String) Unique subscription Id from Azure console.


<a id="nestedblock--gcp_storage_config"></a>
### Nested Schema for `gcp_storage_config`

Required:

- `gcp_json_credentials` (String, Sensitive) The GCP credentials in JSON format. These credentials are required to authenticate and manage.
- `project_id` (String) The GCP project ID.


<a id="nestedblock--s3"></a>
### Nested Schema for `s3`

Expand Down
40 changes: 20 additions & 20 deletions examples/resources/spectrocloud_backup_storage_location/resource.tf
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
resource "spectrocloud_backup_storage_location" "bsl1" {
name = "aaa-project-dev-1"
context = "project"
name = "aaa-project-dev-1"
context = "project"
location_provider = "gcp"
is_default = false
region = "us-east-1"
bucket_name = "project-backup-2"
# s3 {
# credential_type = "secret"
# access_key = "access_key"
# secret_key = "secret_key"
# s3_force_path_style = false
# s3_url = "http://10.90.78.23"
# }
is_default = false
region = "us-east-1"
bucket_name = "project-backup-2"
# s3 {
# credential_type = "secret"
# access_key = "access_key"
# secret_key = "secret_key"
# s3_force_path_style = false
# s3_url = "http://10.90.78.23"
# }
gcp_storage_config {
project_id = "test_id"
project_id = "test_id"
gcp_json_credentials = "test test"
}
azure_storage_config{
container_name = "test-storage-container"
storage_name = "test-backup-storage"
stock_keeping_unit = "test"
resource_group = "test-group"
azure_tenant_id = "test-tenant-id"
azure_client_id = "test-client-id"
azure_storage_config {
container_name = "test-storage-container"
storage_name = "test-backup-storage"
stock_keeping_unit = "test"
resource_group = "test-group"
azure_tenant_id = "test-tenant-id"
azure_client_id = "test-client-id"
azure_client_secret = "test-client-service"
}
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/robfig/cron v1.2.0
github.com/spectrocloud/gomi v1.14.1-0.20240214074114-c19394812368
github.com/spectrocloud/hapi v1.14.1-0.20240214071352-81f589b1d86d
github.com/spectrocloud/palette-sdk-go v0.0.0-20241114040951-b4855be46579
github.com/spectrocloud/palette-sdk-go v0.0.0-20241118202225-472a9f929ec3
github.com/stretchr/testify v1.9.0
gotest.tools v2.2.0+incompatible
k8s.io/api v0.23.5
Expand Down Expand Up @@ -126,4 +126,4 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)

replace github.com/spectrocloud/palette-sdk-go => ../palette-sdk-go
//replace github.com/spectrocloud/palette-sdk-go => ../palette-sdk-go
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ github.com/spectrocloud/gomi v1.14.1-0.20240214074114-c19394812368 h1:eY0BOyEbGu
github.com/spectrocloud/gomi v1.14.1-0.20240214074114-c19394812368/go.mod h1:LlZ9We4kDaELYi7Is0SVmnySuDhwphJLS6ZT4wXxFIk=
github.com/spectrocloud/hapi v1.14.1-0.20240214071352-81f589b1d86d h1:OMRbHxMJ1a+G1BYzvUYuMM0wLkYJPdnEOFx16faQ/UY=
github.com/spectrocloud/hapi v1.14.1-0.20240214071352-81f589b1d86d/go.mod h1:MktpRPnSXDTHsQrFSD+daJFQ1zMLSR+1gWOL31jVvWE=
github.com/spectrocloud/palette-sdk-go v0.0.0-20241114040951-b4855be46579 h1:C8daKBQJbK2DfoIEaHYNXTXaoSNasqMSVnKnc4Q3WyI=
github.com/spectrocloud/palette-sdk-go v0.0.0-20241114040951-b4855be46579/go.mod h1:dSlNvDS0qwUWTbrYI6P8x981mcbbRHFrBg67v5zl81U=
github.com/spectrocloud/palette-sdk-go v0.0.0-20241118202225-472a9f929ec3 h1:DUTKSzkaUuKPYe6biK+vuYpO3I9gbPLPXaoEv1FSvdM=
github.com/spectrocloud/palette-sdk-go v0.0.0-20241118202225-472a9f929ec3/go.mod h1:dSlNvDS0qwUWTbrYI6P8x981mcbbRHFrBg67v5zl81U=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
Expand Down
Loading

0 comments on commit 9c03890

Please sign in to comment.