Skip to content

Commit

Permalink
Add Azure archival location data source (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
johan3141592 committed May 29, 2024
1 parent b94e0d4 commit c4666e8
Show file tree
Hide file tree
Showing 32 changed files with 459 additions and 79 deletions.
3 changes: 2 additions & 1 deletion docs/data-sources/aws_cnp_permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description: |-




## Example Usage

```terraform
Expand All @@ -20,7 +21,7 @@ data "polaris_aws_cnp_permissions" "permissions" {
}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand Down
56 changes: 56 additions & 0 deletions docs/data-sources/azure_archival_location.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
page_title: "polaris_azure_archival_location Data Source - terraform-provider-polaris"
subcategory: ""
description: |-
The `polaris_azure_archival_location` data source is used to access information about an Azure archival location. An archival location is looked up using either the ID or the name.
---

# polaris_azure_archival_location (Data Source)

The `polaris_azure_archival_location` data source is used to access information about an Azure archival location. An archival location is looked up using either the ID or the name.



## Example Usage

```terraform
# Using the archival location ID.
data "polaris_azure_archival_location" "archival_location" {
archival_location_id = "db34f042-79ea-48b1-bab8-c40dfbf2ab82"
}
# Using the archival location name.
data "polaris_azure_archival_location" "archival_location" {
name = "my-archival-location"
}
```


## Schema

### Optional

- `id` (String) Cloud native archival location ID.
- `name` (String) Cloud native archival location name.

### Read-Only

- `connection_status` (String) Connection status of the cloud native archival location.
- `container_name` (String) Azure storage container name.
- `customer_managed_key` (Set of Object) 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](#nestedatt--customer_managed_key))
- `location_template` (String) RSC location template. If a storage account region was specified, it will be `SPECIFIC_REGION`, otherwise `SOURCE_REGION`.
- `redundancy` (String) Azure storage redundancy. Possible values are `GRS`, `GZRS`, `LRS`, `RA_GRS`, `RA_GZRS` and `ZRS`. Default value is `LRS`.
- `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.
- `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.
- `storage_account_tags` (Map of String) Azure storage account tags. Each tag will be added to the storage account created by RSC.
- `storage_tier` (String) Azure storage tier. Possible values are `COOL` and `HOT`. Default value is `COOL`.

<a id="nestedatt--customer_managed_key"></a>
### Nested Schema for `customer_managed_key`

Read-Only:

- `name` (String) Key name.
- `region` (String) The region in which the key will be used. Regions without customer managed keys will use platform managed keys.
- `vault_name` (String) Key vault name.
5 changes: 3 additions & 2 deletions docs/data-sources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
page_title: "polaris_role Data Source - terraform-provider-polaris"
subcategory: ""
description: |-
---

# polaris_role (Data Source)




## Example Usage

```terraform
Expand All @@ -17,7 +18,7 @@ data "polaris_role" "compliance_auditor" {
}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand Down
5 changes: 3 additions & 2 deletions docs/data-sources/role_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
page_title: "polaris_role_template Data Source - terraform-provider-polaris"
subcategory: ""
description: |-
---

# polaris_role_template (Data Source)




## Example Usage

```terraform
Expand All @@ -17,7 +18,7 @@ data "polaris_role_template" "compliance_auditor" {
}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand Down
24 changes: 16 additions & 8 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ page_title: "Changelog"

# Changelog

## v0.9.0-beta.7
* Add `polaris_azure_archival_location` data source. [[docs](../data-sources/azure_archival_location)]
* Fix a bug in the `polaris_azure_archival_location` resource where the cloud account UUID would be passed to the RSC
API instead of the Azure subscription UUID when creating an Azure archival location.
* Fix a bug in the `polaris_aws_cnp_account` resource where destroying it would constantly result in an *objects not
authorized* error.
* Increase the wait time for asynchronous RSC operations to 8.5 minutes.

## v0.9.0-beta.6
* Fix an issue with the permissions of subscriptions onboarded using the `polaris_azure_subscription` resource where
the RSC UI would show the status as "Update permissions" even though the app registration would have all the required
Expand All @@ -13,26 +21,26 @@ page_title: "Changelog"
* Move changelog and upgrade guides to guides folder.

## v0.9.0-beta.4
* Add support for creating Azure cloud native archival locations. [[docs](../../resources/azure_archival_location)]
* Add support for creating Azure cloud native archival locations. [[docs](../resources/azure_archival_location)]

## v0.9.0-beta.3
* Fix a bug in the `polaris_aws_exocompute` resource where customer supplied security groups were not validated
correctly.

## v0.9.0-beta.2
* Add support for shared Exocompute to the `polaris_azure_exocompute` resource.
[[docs](../../resources/azure_exocompute#host_cloud_account_id)]
* Add the `polaris_account` data source. [[docs](../../data-sources/account)]
[[docs](../resources/azure_exocompute#host_cloud_account_id)]
* Add the `polaris_account` data source. [[docs](../data-sources/account)]

## v0.9.0-beta.1
* Add support for the Cloud Native Archival feature to the `polaris_azure_subscription` resource.
[[docs](../../resources/azure_subscription#nested-schema-for-cloud_native_archival)]
[[docs](../resources/azure_subscription#nested-schema-for-cloud_native_archival)]
* Add support for the Cloud Native Archival Encryption feature to the `polaris_azure_subscription` resource.
[[docs](../../resources/azure_subscription#nested-schema-for-cloud_native_archival_encryption)]
[[docs](../resources/azure_subscription#nested-schema-for-cloud_native_archival_encryption)]
* Add support for the Azure SQL Database Protection feature to the `polaris_azure_subscription` resource.
[[docs](../../resources/azure_subscription#nested-schema-for-sql_db_protection)]
[[docs](../resources/azure_subscription#nested-schema-for-sql_db_protection)]
* Add support for the Azure SQL Managed Instance Protection feature to the `polaris_azure_subscription` resource.
[[docs](../../resources/azure_subscription#nested-schema-for-sql_mi_protection)]
[[docs](../resources/azure_subscription#nested-schema-for-sql_mi_protection)]
* Add support for specifying an Azure resource group when onboarding the Cloud Native Archival, Cloud Native Archival
Encryption, Cloud Native Protection or Exocompute features using the `polaris_azure_subscription` resource.
[[docs](../../resources/azure_subscription#optional)]
[[docs](../resources/azure_subscription#optional)]
2 changes: 2 additions & 0 deletions docs/guides/upgrade_guide_beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The latest beta release introduces changes to the following data sources and res
* `polaris_azure_permissions` - Add support for scoped permissions. Permissions are scoped to either the subscription
level or to resource group level. The `hash` field has been deprecated and replaced with the `id` field. Both fields
will have same value until the `hash` field is removed in a future release.
* `polaris_azure_archival_location` - Add support for Azure archival locations, see the data source and resource
documentation for more information.
* `polaris_azure_exocompute` - Add support for shared Exocompute, see the resource documentation for more information.
The `subscription_id` field has been deprecated and replaced with the `cloud_account_id` field. The `subscription_id`
field referred to the ID of the `polaris_azure_subscription` resource and not the Azure subscription ID, which was
Expand Down
32 changes: 31 additions & 1 deletion docs/resources/azure_archival_location.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,37 @@ Custom storage encryption is enabled by specifying one or more `customer_managed

-> **Note:** The Azure storage account is not created until the first protected object is archived to the location.


## Example Usage

```terraform
# Source region.
resource "polaris_azure_archival_location" "archival_location" {
cloud_account_id = polaris_azure_subscription.subscription.id
name = "my-archival-location"
storage_account_name_prefix = "archival"
}
# Source region with a customer managed key.
resource "polaris_azure_archival_location" "archival_location" {
cloud_account_id = polaris_azure_subscription.subscription.id
name = "my-archival-location"
storage_account_name_prefix = "archival"
customer_managed_key {
name = "my-archival-key"
region = "eastus"
vault_name = "my-archival-key-vault"
}
}
# Specific region.
resource "polaris_azure_archival_location" "archival_location" {
cloud_account_id = polaris_azure_subscription.subscription.id
name = "my-archival-location"
storage_account_name_prefix = "archival"
storage_account_region = "eastus2"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
4 changes: 4 additions & 0 deletions docs/resources/cdm_bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ description: |-

# polaris_cdm_bootstrap (Resource)




## Example Usage

```terraform
Expand All @@ -28,6 +31,7 @@ resource "polaris_cdm_bootstrap" "default" {
}
```


## Schema

### Required
Expand Down
6 changes: 5 additions & 1 deletion docs/resources/cdm_bootstrap_cces_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
page_title: "polaris_cdm_bootstrap_cces_aws Resource - terraform-provider-polaris"
subcategory: ""
description: |-
---

# polaris_cdm_bootstrap_cces_aws (Resource)




## Example Usage

```terraform
Expand All @@ -30,6 +33,7 @@ resource "polaris_cdm_bootstrap_cces_aws" "default" {
}
```


## Schema

### Required
Expand Down
6 changes: 5 additions & 1 deletion docs/resources/cdm_bootstrap_cces_azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
page_title: "polaris_cdm_bootstrap_cces_azure Resource - terraform-provider-polaris"
subcategory: ""
description: |-
---

# polaris_cdm_bootstrap_cces_azure (Resource)




## Example Usage

```terraform
Expand All @@ -30,6 +33,7 @@ resource "polaris_cdm_bootstrap_cces_azure" "default" {
}
```


## Schema

### Required
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Using the archival location ID.
data "polaris_azure_archival_location" "archival_location" {
archival_location_id = "db34f042-79ea-48b1-bab8-c40dfbf2ab82"
}

# Using the archival location name.
data "polaris_azure_archival_location" "archival_location" {
name = "my-archival-location"
}
27 changes: 27 additions & 0 deletions examples/resources/polaris_azure_archival_location/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Source region.
resource "polaris_azure_archival_location" "archival_location" {
cloud_account_id = polaris_azure_subscription.subscription.id
name = "my-archival-location"
storage_account_name_prefix = "archival"
}

# Source region with a customer managed key.
resource "polaris_azure_archival_location" "archival_location" {
cloud_account_id = polaris_azure_subscription.subscription.id
name = "my-archival-location"
storage_account_name_prefix = "archival"

customer_managed_key {
name = "my-archival-key"
region = "eastus"
vault_name = "my-archival-key-vault"
}
}

# Specific region.
resource "polaris_azure_archival_location" "archival_location" {
cloud_account_id = polaris_azure_subscription.subscription.id
name = "my-archival-location"
storage_account_name_prefix = "archival"
storage_account_region = "eastus2"
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.7
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.8
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.7 h1:sIodDAcLUHBKCjM24GKtgYIJ0nbbKx6dwrwwBQ6b060=
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.7/go.mod h1:670TFQkxTdbsBwEwR/fDT75hfHwPDTTOiLnyZerbqQk=
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.8 h1:5gjG60RRoxAGPXAL7ECCwy9/mfFbFlSWgnf7+rrgUYI=
github.com/rubrikinc/rubrik-polaris-sdk-for-go v0.10.0-beta.8/go.mod h1:670TFQkxTdbsBwEwR/fDT75hfHwPDTTOiLnyZerbqQk=
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
Expand Down
8 changes: 3 additions & 5 deletions internal/provider/data_source_aws_cnp_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ import (
"github.com/rubrikinc/rubrik-polaris-sdk-for-go/pkg/polaris/graphql/core"
)

// dataSourceAwsPermissions defines the schema for the AWS permissions data
// source.
// This data source uses a template for its documentation due to a bug in the TF
// docs generator. Remember to update the template if the documentation for any
// fields are changed.
func dataSourceAwsPermissions() *schema.Resource {
return &schema.Resource{
ReadContext: awsPermissionsRead,
Expand Down Expand Up @@ -99,9 +100,6 @@ func dataSourceAwsPermissions() *schema.Resource {
}
}

// awsPermissionsRead run the Read operation for the AWS permissions data
// source. Returns all AWS permissions needed of for the specified cloud and
// feature set.
func awsPermissionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
log.Print("[TRACE] awsPermissionsRead")

Expand Down
Loading

0 comments on commit c4666e8

Please sign in to comment.