Skip to content

Commit 910581c

Browse files
authored
Add support for Azure Blob Storage protection (#204)
1 parent 6b85725 commit 910581c

File tree

7 files changed

+94
-23
lines changed

7 files changed

+94
-23
lines changed

docs/data-sources/azure_permissions.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description: |-
1010
* AZURE_SQL_MI_PROTECTION
1111
* CLOUD_NATIVE_ARCHIVAL
1212
* CLOUD_NATIVE_ARCHIVAL_ENCRYPTION
13+
* CLOUD_NATIVE_BLOB_PROTECTION
1314
* CLOUD_NATIVE_PROTECTION
1415
* EXOCOMPUTE
1516
See the subscription ../resources/azure_subscription resource for more information
@@ -40,6 +41,7 @@ supported for Azure subscriptions are:
4041
* `AZURE_SQL_MI_PROTECTION`
4142
* `CLOUD_NATIVE_ARCHIVAL`
4243
* `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`
44+
* `CLOUD_NATIVE_BLOB_PROTECTION`
4345
* `CLOUD_NATIVE_PROTECTION`
4446
* `EXOCOMPUTE`
4547

@@ -99,8 +101,8 @@ resource "polaris_azure_subscription" "subscription" {
99101

100102
### Optional
101103

102-
- `feature` (String) RSC feature. Note that the feature name must be given in the `EXAMPLE_FEATURE_NAME` style. Possible values are `AZURE_SQL_DB_PROTECTION`, `AZURE_SQL_MI_PROTECTION`, `CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, `CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`.
103-
- `features` (Set of String, Deprecated) RSC features. Possible values are `AZURE_SQL_DB_PROTECTION`, `AZURE_SQL_MI_PROTECTION`, `CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, `CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`. **Deprecated:** use `feature` instead.
104+
- `feature` (String) RSC feature. Note that the feature name must be given in the `EXAMPLE_FEATURE_NAME` style. Possible values are `AZURE_SQL_DB_PROTECTION`, `AZURE_SQL_MI_PROTECTION`, `CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, `CLOUD_NATIVE_BLOB_PROTECTION`, `CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`.
105+
- `features` (Set of String, Deprecated) RSC features. Possible values are `AZURE_SQL_DB_PROTECTION`, `AZURE_SQL_MI_PROTECTION`, `CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, `CLOUD_NATIVE_BLOB_PROTECTION`, `CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`. **Deprecated:** use `feature` instead.
104106

105107
### Read-Only
106108

docs/resources/azure_subscription.md

+17
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ resource "polaris_azure_subscription" "default" {
152152

153153
- `cloud_native_archival` (Block List, Max: 1) Enable the RSC Cloud Native Archival feature for the Azure subscription. (see [below for nested schema](#nestedblock--cloud_native_archival))
154154
- `cloud_native_archival_encryption` (Block List, Max: 1) Enable the RSC Cloud Native Archival Encryption feature for the Azure subscription. (see [below for nested schema](#nestedblock--cloud_native_archival_encryption))
155+
- `cloud_native_blob_protection` (Block List, Max: 1) Enable the RSC Cloud Native Protection feature for Azure Blob Storage. (see [below for nested schema](#nestedblock--cloud_native_blob_protection))
155156
- `cloud_native_protection` (Block List, Max: 1) Enable the RSC Cloud Native Protection feature for the Azure subscription. (see [below for nested schema](#nestedblock--cloud_native_protection))
156157
- `delete_snapshots_on_destroy` (Boolean) Should snapshots be deleted when the resource is destroyed. Default value is `false`.
157158
- `exocompute` (Block List, Max: 1) Enable the RSC Exocompute feature for the Azure subscription. (see [below for nested schema](#nestedblock--exocompute))
@@ -205,6 +206,22 @@ Read-Only:
205206
- `status` (String) Status of the Cloud Native Archival Encryption feature.
206207

207208

209+
<a id="nestedblock--cloud_native_blob_protection"></a>
210+
### Nested Schema for `cloud_native_blob_protection`
211+
212+
Required:
213+
214+
- `regions` (Set of String) Azure regions that RSC will monitor for resources to protect according to SLA Domains. Should be specified in the standard Azure style, e.g. `eastus`.
215+
216+
Optional:
217+
218+
- `permissions` (String) Permissions updated signal. When this field changes, the provider will notify RSC that the permissions for the feature has been updated. Use this field with the `polaris_azure_permissions` data source.
219+
220+
Read-Only:
221+
222+
- `status` (String) Status of the Cloud Native Blob Protection feature.
223+
224+
208225
<a id="nestedblock--cloud_native_protection"></a>
209226
### Nested Schema for `cloud_native_protection`
210227

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.34.0
11-
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.11.0-beta.6
11+
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.11.0-beta.7
1212
)
1313

1414
require (

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg
270270
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
271271
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
272272
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
273-
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.11.0-beta.6 h1:7tIuXO7wf/zLBmYtd3HXevp733UeHRY5VzrLSzgA57g=
274-
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.11.0-beta.6/go.mod h1:ryJGDKlbaCvozY3Wvt+TPSN2OZRChQedHUNsnVfCbXE=
273+
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.11.0-beta.7 h1:n3tfrj61TLoKKkywcboFjEb/sd+G53vJV13dfV14k3Q=
274+
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.11.0-beta.7/go.mod h1:ryJGDKlbaCvozY3Wvt+TPSN2OZRChQedHUNsnVfCbXE=
275275
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
276276
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
277277
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=

internal/provider/data_source_azure_permissions.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ supported for Azure subscriptions are:
4141
* ´AZURE_SQL_MI_PROTECTION´
4242
* ´CLOUD_NATIVE_ARCHIVAL´
4343
* ´CLOUD_NATIVE_ARCHIVAL_ENCRYPTION´
44+
* ´CLOUD_NATIVE_BLOB_PROTECTION´
4445
* ´CLOUD_NATIVE_PROTECTION´
4546
* ´EXOCOMPUTE´
4647
@@ -105,11 +106,12 @@ func dataSourceAzurePermissions() *schema.Resource {
105106
ExactlyOneOf: []string{keyFeature, keyFeatures},
106107
Description: "RSC feature. Note that the feature name must be given in the `EXAMPLE_FEATURE_NAME` " +
107108
"style. Possible values are `AZURE_SQL_DB_PROTECTION`, `AZURE_SQL_MI_PROTECTION`, " +
108-
"`CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, `CLOUD_NATIVE_PROTECTION` and " +
109-
"`EXOCOMPUTE`.",
109+
"`CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, `CLOUD_NATIVE_BLOB_PROTECTION`, " +
110+
"`CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`.",
110111
ValidateFunc: validation.StringInSlice([]string{
111112
"AZURE_SQL_DB_PROTECTION", "AZURE_SQL_MI_PROTECTION", "CLOUD_NATIVE_ARCHIVAL",
112-
"CLOUD_NATIVE_ARCHIVAL_ENCRYPTION", "CLOUD_NATIVE_PROTECTION", "EXOCOMPUTE",
113+
"CLOUD_NATIVE_ARCHIVAL_ENCRYPTION", "CLOUD_NATIVE_BLOB_PROTECTION", "CLOUD_NATIVE_PROTECTION",
114+
"EXOCOMPUTE",
113115
}, false),
114116
},
115117
keyFeatures: {
@@ -118,14 +120,16 @@ func dataSourceAzurePermissions() *schema.Resource {
118120
Type: schema.TypeString,
119121
ValidateFunc: validation.StringInSlice([]string{
120122
"AZURE_SQL_DB_PROTECTION", "AZURE_SQL_MI_PROTECTION", "CLOUD_NATIVE_ARCHIVAL",
121-
"CLOUD_NATIVE_ARCHIVAL_ENCRYPTION", "CLOUD_NATIVE_PROTECTION", "EXOCOMPUTE",
123+
"CLOUD_NATIVE_ARCHIVAL_ENCRYPTION", "CLOUD_NATIVE_BLOB_PROTECTION", "CLOUD_NATIVE_PROTECTION",
124+
"EXOCOMPUTE",
122125
}, false),
123126
},
124127
MinItems: 1,
125128
Optional: true,
126129
Description: "RSC features. Possible values are `AZURE_SQL_DB_PROTECTION`, " +
127130
"`AZURE_SQL_MI_PROTECTION`, `CLOUD_NATIVE_ARCHIVAL`, `CLOUD_NATIVE_ARCHIVAL_ENCRYPTION`, " +
128-
"`CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`. **Deprecated:** use `feature` instead.",
131+
"`CLOUD_NATIVE_BLOB_PROTECTION`, `CLOUD_NATIVE_PROTECTION` and `EXOCOMPUTE`. **Deprecated:** " +
132+
"use `feature` instead.",
129133
Deprecated: "use `feature` instead",
130134
},
131135
keyHash: {

internal/provider/names.go

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const (
4242
keyCloudComputeSettings = "cloud_compute_settings"
4343
keyCloudNativeArchival = "cloud_native_archival"
4444
keyCloudNativeArchivalEncryption = "cloud_native_archival_encryption"
45+
keyCloudNativeBlobProtection = "cloud_native_blob_protection"
4546
keyCloudNativeProtection = "cloud_native_protection"
4647
keyClusterID = "cluster_id"
4748
keyClusterName = "cluster_name"

internal/provider/resource_azure_subscription.go

+60-13
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func resourceAzureSubscription() *schema.Resource {
157157
MaxItems: 1,
158158
Optional: true,
159159
AtLeastOneOf: []string{
160-
keyCloudNativeArchival,
160+
keyCloudNativeBlobProtection,
161161
keyCloudNativeProtection,
162162
keyExocompute,
163163
keySQLDBProtection,
@@ -261,6 +261,46 @@ func resourceAzureSubscription() *schema.Resource {
261261
},
262262
Description: "Enable the RSC Cloud Native Archival Encryption feature for the Azure subscription.",
263263
},
264+
keyCloudNativeBlobProtection: {
265+
Type: schema.TypeList,
266+
Elem: &schema.Resource{
267+
Schema: map[string]*schema.Schema{
268+
keyPermissions: {
269+
Type: schema.TypeString,
270+
Optional: true,
271+
Description: "Permissions updated signal. When this field changes, the provider will notify " +
272+
"RSC that the permissions for the feature has been updated. Use this field with the " +
273+
"`polaris_azure_permissions` data source.",
274+
ValidateFunc: validation.StringIsNotWhiteSpace,
275+
},
276+
keyRegions: {
277+
Type: schema.TypeSet,
278+
Elem: &schema.Schema{
279+
Type: schema.TypeString,
280+
},
281+
MinItems: 1,
282+
Required: true,
283+
Description: "Azure regions that RSC will monitor for resources to protect according to " +
284+
"SLA Domains. Should be specified in the standard Azure style, e.g. `eastus`.",
285+
},
286+
keyStatus: {
287+
Type: schema.TypeString,
288+
Computed: true,
289+
Description: "Status of the Cloud Native Blob Protection feature.",
290+
},
291+
},
292+
},
293+
MaxItems: 1,
294+
Optional: true,
295+
AtLeastOneOf: []string{
296+
keyCloudNativeArchival,
297+
keyCloudNativeProtection,
298+
keyExocompute,
299+
keySQLDBProtection,
300+
keySQLMIProtection,
301+
},
302+
Description: "Enable the RSC Cloud Native Protection feature for Azure Blob Storage.",
303+
},
264304
keyCloudNativeProtection: {
265305
Type: schema.TypeList,
266306
Elem: &schema.Resource{
@@ -328,7 +368,7 @@ func resourceAzureSubscription() *schema.Resource {
328368
Optional: true,
329369
AtLeastOneOf: []string{
330370
keyCloudNativeArchival,
331-
keyCloudNativeProtection,
371+
keyCloudNativeBlobProtection,
332372
keyExocompute,
333373
keySQLDBProtection,
334374
keySQLMIProtection,
@@ -408,8 +448,8 @@ func resourceAzureSubscription() *schema.Resource {
408448
Optional: true,
409449
AtLeastOneOf: []string{
410450
keyCloudNativeArchival,
451+
keyCloudNativeBlobProtection,
411452
keyCloudNativeProtection,
412-
keyExocompute,
413453
keySQLDBProtection,
414454
keySQLMIProtection,
415455
},
@@ -448,9 +488,9 @@ func resourceAzureSubscription() *schema.Resource {
448488
Optional: true,
449489
AtLeastOneOf: []string{
450490
keyCloudNativeArchival,
491+
keyCloudNativeBlobProtection,
451492
keyCloudNativeProtection,
452493
keyExocompute,
453-
keySQLDBProtection,
454494
keySQLMIProtection,
455495
},
456496
Description: "Enable the RSC SQL DB Protection feature for the Azure subscription.",
@@ -488,10 +528,10 @@ func resourceAzureSubscription() *schema.Resource {
488528
Optional: true,
489529
AtLeastOneOf: []string{
490530
keyCloudNativeArchival,
531+
keyCloudNativeBlobProtection,
491532
keyCloudNativeProtection,
492533
keyExocompute,
493534
keySQLDBProtection,
494-
keySQLMIProtection,
495535
},
496536
Description: "Enable the RSC SQL MI Protection feature for the Azure subscription.",
497537
},
@@ -841,34 +881,41 @@ var azureKeyFeatureMap = map[string]orderedFeature{
841881
orderSplitAdd: 203,
842882
orderSplitRemove: 200,
843883
},
844-
keyCloudNativeProtection: {
845-
feature: core.FeatureCloudNativeProtection,
884+
keyCloudNativeBlobProtection: {
885+
feature: core.FeatureCloudNativeBlobProtection,
846886
orderAdd: 102,
847887
orderRemove: 302,
848888
orderSplitAdd: 205,
849889
orderSplitRemove: 204,
850890
},
851-
keyExocompute: {
852-
feature: core.FeatureExocompute,
891+
keyCloudNativeProtection: {
892+
feature: core.FeatureCloudNativeProtection,
853893
orderAdd: 103,
854894
orderRemove: 303,
855895
orderSplitAdd: 207,
856896
orderSplitRemove: 206,
857897
},
858-
keySQLDBProtection: {
859-
feature: core.FeatureAzureSQLDBProtection,
898+
keyExocompute: {
899+
feature: core.FeatureExocompute,
860900
orderAdd: 104,
861901
orderRemove: 304,
862902
orderSplitAdd: 209,
863903
orderSplitRemove: 208,
864904
},
865-
keySQLMIProtection: {
866-
feature: core.FeatureAzureSQLMIProtection,
905+
keySQLDBProtection: {
906+
feature: core.FeatureAzureSQLDBProtection,
867907
orderAdd: 105,
868908
orderRemove: 305,
869909
orderSplitAdd: 211,
870910
orderSplitRemove: 210,
871911
},
912+
keySQLMIProtection: {
913+
feature: core.FeatureAzureSQLMIProtection,
914+
orderAdd: 106,
915+
orderRemove: 306,
916+
orderSplitAdd: 213,
917+
orderSplitRemove: 212,
918+
},
872919
}
873920

874921
// addAzureFeature onboards the RSC feature for the Azure subscription.

0 commit comments

Comments
 (0)