Skip to content

Commit c6e12c9

Browse files
authored
Add support for Azure archival locations (#168)
1 parent db58084 commit c6e12c9

9 files changed

+457
-18
lines changed

docs/changelog.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ page_title: "Changelog"
55
# Changelog
66

77
## v0.9.0-beta.4
8-
* Fix an issue with the permissions of subscriptions onboarded using the `polaris_azure_subscription` resource where
9-
the RSC UI would show the status as "Update permissions" even though the app registration would have all the required
10-
permissions.
8+
* Add support for creating Azure cloud native archival locations. [[docs](resources/azure_archival_location)]
119

1210
## v0.9.0-beta.3
1311
* Fix a bug in the `polaris_aws_exocompute` resource where customer supplied security groups were not validated
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "polaris_azure_archival_location Resource - terraform-provider-polaris"
4+
subcategory: ""
5+
description: |-
6+
The polaris_azure_archival_location resource creates an RSC archival location for cloud-native workloads.
7+
When creating an archival location, the region where the snapshots are stored needs to be specified:
8+
* Source Region - Store snapshots in the same region to minimize data transfer charges. This is the default behaviour when the storage_account_region field is not specified.
9+
* Specific region - Storing snapshots in another region can increase total data transfer charges. The storage_account_region field specifies the region.
10+
Custom storage encryption is enabled by specifying one or more customer_managed_key blocks. Each customer_managed_key block specifies the encryption details to use for a region. For other regions, data will be encrypted using platform managed keys.
11+
-> Note: The Azure storage account is not created until the first protected object is archived to the location.
12+
---
13+
14+
# polaris_azure_archival_location (Resource)
15+
16+
The `polaris_azure_archival_location` resource creates an RSC archival location for cloud-native workloads.
17+
18+
When creating an archival location, the region where the snapshots are stored needs to be specified:
19+
* *Source Region* - Store snapshots in the same region to minimize data transfer charges. This is the default behaviour when the `storage_account_region` field is not specified.
20+
* *Specific region* - Storing snapshots in another region can increase total data transfer charges. The `storage_account_region` field specifies the region.
21+
22+
Custom storage encryption is enabled by specifying one or more `customer_managed_key` blocks. Each `customer_managed_key` block specifies the encryption details to use for a region. For other regions, data will be encrypted using platform managed keys.
23+
24+
-> **Note:** The Azure storage account is not created until the first protected object is archived to the location.
25+
26+
27+
28+
<!-- schema generated by tfplugindocs -->
29+
## Schema
30+
31+
### Required
32+
33+
- `cloud_account_id` (String) RSC cloud account ID.
34+
- `name` (String) Cloud native archival location name.
35+
- `storage_account_name_prefix` (String) Azure storage account name prefix. The storage account name prefix cannot be longer than 14 characters and can only consist of numbers and lower case letters.
36+
37+
### Optional
38+
39+
- `customer_managed_key` (Block Set) Customer managed storage encryption. Specify the regions and their respective encryption details. For other regions, data will be encrypted using platform managed keys. (see [below for nested schema](#nestedblock--customer_managed_key))
40+
- `redundancy` (String) Azure storage redundancy. Possible values are `GRS`, `GZRS`, `LRS`, `RA_GRS`, `RA_GZRS` and `ZRS`. Default value is `LRS`.
41+
- `storage_account_region` (String) Azure region to store the snapshots in. If not specified, the snapshots will be stored in the same region as the workload.
42+
- `storage_account_tags` (Map of String) Azure storage account tags. Each tag will be added to the storage account created by RSC.
43+
- `storage_tier` (String) Azure storage tier. Possible values are `COOL` and `HOT`. Default value is `COOL`.
44+
45+
### Read-Only
46+
47+
- `connection_status` (String) Connection status of the cloud native archival location.
48+
- `container_name` (String) Azure storage container name.
49+
- `id` (String) Cloud native archival location ID.
50+
- `location_template` (String) RSC location template. If a storage account region was specified, it will be `SPECIFIC_REGION`, otherwise `SOURCE_REGION`.
51+
52+
<a id="nestedblock--customer_managed_key"></a>
53+
### Nested Schema for `customer_managed_key`
54+
55+
Required:
56+
57+
- `name` (String) Key name.
58+
- `region` (String) The region in which the key will be used. Regions without customer managed keys will use platform managed keys.
59+
- `vault_name` (String) Key vault name.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
99
github.com/hashicorp/terraform-plugin-docs v0.16.0
1010
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
11-
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.5
11+
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.6
1212
)
1313

1414
require (

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
412412
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
413413
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
414414
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
415-
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.5 h1:J/+s4lkvAn9FHb8gYY14Ea6wsCSNMS/Dhz+hs+R4YOw=
416-
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.5/go.mod h1:670TFQkxTdbsBwEwR/fDT75hfHwPDTTOiLnyZerbqQk=
415+
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.6 h1:zGFHwJHotDDXgdN7WzQWTh8BDjCzGWTsrMJ1/3Ro+wg=
416+
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.6/go.mod h1:670TFQkxTdbsBwEwR/fDT75hfHwPDTTOiLnyZerbqQk=
417417
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
418418
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
419419
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=

internal/provider/provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func Provider() *schema.Provider {
6161
"polaris_aws_exocompute": resourceAwsExocompute(),
6262
"polaris_aws_exocompute_cluster_attachment": resourceAwsExocomputeClusterAttachment(),
6363
"polaris_aws_private_container_registry": resourceAwsPrivateContainerRegistry(),
64+
keyPolarisAzureArchivalLocation: resourceAzureArchivalLocation(),
6465
keyPolarisAzureExocompute: resourceAzureExocompute(),
6566
keyPolarisAzureServicePrincipal: resourceAzureServicePrincipal(),
6667
keyPolarisAzureSubscription: resourceAzureSubscription(),

internal/provider/resource_aws_archival_location.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ func awsUpdateArchivalLocation(ctx context.Context, d *schema.ResourceData, m in
214214
// Lookup and parse the target mapping ID from the resource ID.
215215
targetMappingID, err := uuid.Parse(d.Id())
216216
if err != nil {
217-
d.SetId("")
218217
return diag.FromErr(err)
219218
}
220219

@@ -255,8 +254,8 @@ func awsDeleteArchivalLocation(ctx context.Context, d *schema.ResourceData, m in
255254
return nil
256255
}
257256

258-
// fromBucketTags converts from the bucket tags argument to a standard string to
259-
// string map.
257+
// fromBucketTags converts from the bucket tags argument to a standard
258+
// string-to-string map.
260259
func fromBucketTags(bucketTags map[string]any) (map[string]string, error) {
261260
tags := make(map[string]string, len(bucketTags))
262261
for key, value := range bucketTags {
@@ -270,8 +269,8 @@ func fromBucketTags(bucketTags map[string]any) (map[string]string, error) {
270269
return tags, nil
271270
}
272271

273-
// toBucketTags converts to the bucket tags argument from a standard string to
274-
// string map.
272+
// toBucketTags converts to the bucket tags argument from a standard
273+
// string-to-string map.
275274
func toBucketTags(tags map[string]string) map[string]any {
276275
bucketTags := make(map[string]any, len(tags))
277276
for key, value := range tags {

0 commit comments

Comments
 (0)