-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Resource for External Volumes #3106
Changes from all commits
1704a50
afbd4a0
fd4062e
f143a26
afe0235
2304ae4
1f190e6
68c104d
337f545
4f89a9d
2c09c7d
15b8738
90f2c88
6029e87
ff43f8a
8ac4af1
184b06c
b2836c7
c4af02d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
page_title: "snowflake_external_volume Resource - terraform-provider-snowflake" | ||
subcategory: "" | ||
description: |- | ||
Resource used to manage external volume objects. For more information, check external volume documentation https://docs.snowflake.com/en/sql-reference/commands-data-loading#external-volume. | ||
--- | ||
|
||
!> **V1 release candidate** This resource was reworked and is a release candidate for the V1. We do not expect significant changes in it before the V1. We will welcome any feedback and adjust the resource if needed. Any errors reported will be resolved with a higher priority. We encourage checking this resource out before the V1 release. | ||
|
||
# snowflake_external_volume (Resource) | ||
|
||
Resource used to manage external volume objects. For more information, check [external volume documentation](https://docs.snowflake.com/en/sql-reference/commands-data-loading#external-volume). | ||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) Identifier for the external volume; must be unique for your account. Due to technical limitations (read more [here](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/identifiers_rework_design_decisions.md#known-limitations-and-identifier-recommendations)), avoid using the following characters: `|`, `.`, `(`, `)`, `"` | ||
- `storage_location` (Block List, Min: 1) List of named cloud storage locations in different regions and, optionally, cloud platforms. Minimum 1 required. The order of the list is important as it impacts the active storage location, and updates will be triggered if it changes. Note that not all parameter combinations are valid as they depend on the given storage_provider. Consult [the docs](https://docs.snowflake.com/en/sql-reference/sql/create-external-volume#cloud-provider-parameters-cloudproviderparams) for more details on this. (see [below for nested schema](#nestedblock--storage_location)) | ||
|
||
### Optional | ||
|
||
- `allow_writes` (String) Specifies whether write operations are allowed for the external volume; must be set to TRUE for Iceberg tables that use Snowflake as the catalog. Available options are: "true" or "false". When the value is not set in the configuration the provider will put "default" there which means to use the Snowflake default for this value. | ||
- `comment` (String) Specifies a comment for the external volume. | ||
|
||
### Read-Only | ||
|
||
- `describe_output` (List of Object) Outputs the result of `DESCRIBE EXTERNAL VOLUME` for the given external volume. (see [below for nested schema](#nestedatt--describe_output)) | ||
- `fully_qualified_name` (String) Fully qualified name of the resource. For more information, see [object name resolution](https://docs.snowflake.com/en/sql-reference/name-resolution). | ||
- `id` (String) The ID of this resource. | ||
- `show_output` (List of Object) Outputs the result of `SHOW EXTERNAL VOLUMES` for the given external volume. (see [below for nested schema](#nestedatt--show_output)) | ||
|
||
<a id="nestedblock--storage_location"></a> | ||
### Nested Schema for `storage_location` | ||
|
||
Required: | ||
|
||
- `storage_base_url` (String) Specifies the base URL for your cloud storage location. | ||
- `storage_location_name` (String) Name of the storage location. Must be unique for the external volume. Do not use the name `terraform_provider_sentinel_storage_location` - this is reserved for the provider for performing update operations. Due to technical limitations (read more [here](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/identifiers_rework_design_decisions.md#known-limitations-and-identifier-recommendations)), avoid using the following characters: `|`, `.`, `(`, `)`, `"` | ||
- `storage_provider` (String) Specifies the cloud storage provider that stores your data files. Valid values are (case-insensitive): `GCS` | `AZURE` | `S3` | `S3GOV`. | ||
|
||
Optional: | ||
|
||
- `azure_tenant_id` (String) Specifies the ID for your Office 365 tenant that the allowed and blocked storage accounts belong to. | ||
- `encryption_kms_key_id` (String) Specifies the ID for the KMS-managed key used to encrypt files. | ||
- `encryption_type` (String) Specifies the encryption type used. | ||
- `storage_aws_role_arn` (String) Specifies the case-sensitive Amazon Resource Name (ARN) of the AWS identity and access management (IAM) role that grants privileges on the S3 bucket containing your data files. | ||
|
||
Read-Only: | ||
|
||
- `storage_aws_external_id` (String) External ID that Snowflake uses to establish a trust relationship with AWS. | ||
|
||
|
||
<a id="nestedatt--describe_output"></a> | ||
### Nested Schema for `describe_output` | ||
|
||
Read-Only: | ||
|
||
- `default` (String) | ||
- `name` (String) | ||
- `parent` (String) | ||
- `type` (String) | ||
- `value` (String) | ||
|
||
|
||
<a id="nestedatt--show_output"></a> | ||
### Nested Schema for `show_output` | ||
|
||
Read-Only: | ||
|
||
- `allow_writes` (Boolean) | ||
- `comment` (String) | ||
- `name` (String) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package resourceassert | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert" | ||
) | ||
|
||
func (e *ExternalVolumeResourceAssert) HasStorageLocationLength(len int) *ExternalVolumeResourceAssert { | ||
jdoldis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
e.AddAssertion(assert.ValueSet("storage_location.#", strconv.FormatInt(int64(len), 10))) | ||
return e | ||
} | ||
|
||
func (e *ExternalVolumeResourceAssert) HasStorageLocationAtIndex( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: we can pass here a slice of a custom struct with these fields. But it's okay like this. |
||
index int, | ||
expectedName string, | ||
expectedStorageProvider string, | ||
expectedStorageBaseUrl string, | ||
expectedStorageAwsRoleArn string, | ||
expectedEncryptionType string, | ||
expectedEncryptionKmsKeyId string, | ||
expectedAzureTenantId string, | ||
) *ExternalVolumeResourceAssert { | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.storage_location_name", strconv.Itoa(index)), expectedName)) | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.storage_provider", strconv.Itoa(index)), expectedStorageProvider)) | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.storage_base_url", strconv.Itoa(index)), expectedStorageBaseUrl)) | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.storage_aws_role_arn", strconv.Itoa(index)), expectedStorageAwsRoleArn)) | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.encryption_type", strconv.Itoa(index)), expectedEncryptionType)) | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.encryption_kms_key_id", strconv.Itoa(index)), expectedEncryptionKmsKeyId)) | ||
e.AddAssertion(assert.ValueSet(fmt.Sprintf("storage_location.%s.azure_tenant_id", strconv.Itoa(index)), expectedAzureTenantId)) | ||
return e | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V1 candidate note is missing, a new template has to be created in the
templates/resources
directory for external volume (you can copy-paste theschema.md.tmpl
one, but change the migration guide link header to the correct one).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added that without a migration guide link for now as I'm not sure when we'll get it released, will leave the comment as unresolved so we don't forget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we don't want this note here. This object is not officially supported and requires a follow-up on our side. After this follow-up (also with an entry in the migration guide), we can add a note about the release candidate.
We can merge it now, but this note shouldn't be present in the next release.