Skip to content

Commit

Permalink
Mark preview remaining features
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Dec 12, 2024
1 parent cd1db7c commit 7c302ac
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 64 deletions.
3 changes: 2 additions & 1 deletion pkg/datasources/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/datasources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"

Expand Down Expand Up @@ -66,7 +67,7 @@ var functionsSchema = map[string]*schema.Schema{

func Functions() *schema.Resource {
return &schema.Resource{
ReadContext: TrackingReadWrapper(datasources.Functions, ReadContextFunctions),
ReadContext: PreviewFeatureReadWrapper(string(previewfeatures.FunctionsDatasource), TrackingReadWrapper(datasources.Functions, ReadContextFunctions)),
Schema: functionsSchema,
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasources/procedures.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/datasources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"

Expand Down Expand Up @@ -67,7 +68,7 @@ var proceduresSchema = map[string]*schema.Schema{

func Procedures() *schema.Resource {
return &schema.Resource{
ReadContext: TrackingReadWrapper(datasources.Procedures, ReadContextProcedures),
ReadContext: PreviewFeatureReadWrapper(string(previewfeatures.ProceduresDatasource), TrackingReadWrapper(datasources.Procedures, ReadContextProcedures)),
Schema: proceduresSchema,
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/datasources/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/datasources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"
Expand Down Expand Up @@ -55,7 +56,7 @@ var tablesSchema = map[string]*schema.Schema{

func Tables() *schema.Resource {
return &schema.Resource{
ReadContext: TrackingReadWrapper(datasources.Tables, ReadTables),
ReadContext: PreviewFeatureReadWrapper(string(previewfeatures.TablesDatasource), TrackingReadWrapper(datasources.Tables, ReadTables)),
Schema: tablesSchema,
}
}
Expand Down
108 changes: 58 additions & 50 deletions pkg/provider/previewfeatures/preview_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,72 @@ import (
type feature string

const (
CurrentAccountDatasource feature = "snowflake_current_account_datasource"
AccountPasswordPolicyAttachmentResource feature = "snowflake_account_password_policy_attachment_resource"
AlertResource feature = "snowflake_alert_resource"
AlertsDatasource feature = "snowflake_alerts_datasource"
ApiIntegrationResource feature = "snowflake_api_integration_resource"
CortexSearchServiceResource feature = "snowflake_cortex_search_service_resource"
CortexSearchServicesDatasource feature = "snowflake_cortex_search_services_datasource"
DatabaseDatasource feature = "snowflake_database_datasource"
DatabaseRoleDatasource feature = "snowflake_database_role_datasource"
DynamicTableResource feature = "snowflake_dynamic_table_resource"
DynamicTablesDatasource feature = "snowflake_dynamic_tables_datasource"
ExternalFunctionResource feature = "snowflake_external_function_resource"
ExternalFunctionsDatasource feature = "snowflake_external_functions_datasource"
ExternalTableResource feature = "snowflake_external_table_resource"
ExternalTablesDatasource feature = "snowflake_external_tables_datasource"
ExternalVolumeResource feature = "snowflake_external_volume_resource"
FailoverGroupResource feature = "snowflake_failover_group_resource"
FailoverGroupsDatasource feature = "snowflake_failover_groups_datasource"
FileFormatResource feature = "snowflake_file_format_resource"
FileFormatsDatasource feature = "snowflake_file_formats_datasource"
ManagedAccountResource feature = "snowflake_managed_account_resource"
MaterializedViewResource feature = "snowflake_materialized_view_resource"
MaterializedViewsDatasource feature = "snowflake_materialized_views_datasource"
NetworkPolicyAttachmentResource feature = "snowflake_network_policy_attachment_resource"
NetworkRuleResource feature = "snowflake_network_rule_resource"
EmailNotificationIntegrationResource feature = "snowflake_email_notification_integration_resource"
NotificationIntegrationResource feature = "snowflake_notification_integration_resource"
ObjectParameterResource feature = "snowflake_object_parameter_resource"
PasswordPolicyResource feature = "snowflake_password_policy_resource"
PipeResource feature = "snowflake_pipe_resource"
PipesDatasource feature = "snowflake_pipes_datasource"
CurrentRoleDatasource feature = "snowflake_current_role_datasource"
SequenceResource feature = "snowflake_sequence_resource"
SequencesDatasource feature = "snowflake_sequences_datasource"
ShareResource feature = "snowflake_share_resource"
SharesDatasource feature = "snowflake_shares_datasource"
ParametersDatasource feature = "snowflake_parameters_datasource"
StageResource feature = "snowflake_stage_resource"
StagesDatasource feature = "snowflake_stages_datasource"
StorageIntegrationResource feature = "snowflake_storage_integration_resource"
StorageIntegrationsDatasource feature = "snowflake_storage_integrations_datasource"
SystemGenerateSCIMAccessTokenDatasource feature = "snowflake_system_generate_scim_access_token_datasource"
SystemGetAWSSNSIAMPolicyDatasource feature = "snowflake_system_get_aws_sns_iam_policy_datasource"
SystemGetPrivateLinkConfigDatasource feature = "snowflake_system_get_privatelink_config_datasource"
SystemGetSnowflakePlatformInfoDatasource feature = "snowflake_system_get_snowflake_platform_info_datasource"
TableColumnMaskingPolicyApplicationResource feature = "snowflake_table_column_masking_policy_application_resource"
TableConstraintResource feature = "snowflake_table_constraint_resource"
UserAuthenticationPolicyAttachmentResource feature = "snowflake_user_authentication_policy_attachment_resource"
UserPublicKeysResource feature = "snowflake_user_public_keys_resource"
UserPasswordPolicyAttachmentResource feature = "snowflake_user_password_policy_attachment_resource"
CurrentAccountDatasource feature = "snowflake_current_account_datasource"
AccountAuthenticationPolicyAttachmentResource feature = "snowflake_account_authentication_policy_attachment_resource"
AccountPasswordPolicyAttachmentResource feature = "snowflake_account_password_policy_attachment_resource"
AlertResource feature = "snowflake_alert_resource"
AlertsDatasource feature = "snowflake_alerts_datasource"
ApiIntegrationResource feature = "snowflake_api_integration_resource"
AuthenticationPolicyResource feature = "snowflake_authentication_policy_resource"
CortexSearchServiceResource feature = "snowflake_cortex_search_service_resource"
CortexSearchServicesDatasource feature = "snowflake_cortex_search_services_datasource"
DatabaseDatasource feature = "snowflake_database_datasource"
DatabaseRoleDatasource feature = "snowflake_database_role_datasource"
DynamicTableResource feature = "snowflake_dynamic_table_resource"
DynamicTablesDatasource feature = "snowflake_dynamic_tables_datasource"
ExternalFunctionResource feature = "snowflake_external_function_resource"
ExternalFunctionsDatasource feature = "snowflake_external_functions_datasource"
ExternalTableResource feature = "snowflake_external_table_resource"
ExternalTablesDatasource feature = "snowflake_external_tables_datasource"
ExternalVolumeResource feature = "snowflake_external_volume_resource"
FailoverGroupResource feature = "snowflake_failover_group_resource"
FailoverGroupsDatasource feature = "snowflake_failover_groups_datasource"
FileFormatResource feature = "snowflake_file_format_resource"
FileFormatsDatasource feature = "snowflake_file_formats_datasource"
FunctionsDatasource feature = "snowflake_functions_datasource"
ManagedAccountResource feature = "snowflake_managed_account_resource"
MaterializedViewResource feature = "snowflake_materialized_view_resource"
MaterializedViewsDatasource feature = "snowflake_materialized_views_datasource"
NetworkPolicyAttachmentResource feature = "snowflake_network_policy_attachment_resource"
NetworkRuleResource feature = "snowflake_network_rule_resource"
EmailNotificationIntegrationResource feature = "snowflake_email_notification_integration_resource"
NotificationIntegrationResource feature = "snowflake_notification_integration_resource"
ObjectParameterResource feature = "snowflake_object_parameter_resource"
PasswordPolicyResource feature = "snowflake_password_policy_resource"
PipeResource feature = "snowflake_pipe_resource"
PipesDatasource feature = "snowflake_pipes_datasource"
ProceduresDatasource feature = "snowflake_procedures_datasource"
CurrentRoleDatasource feature = "snowflake_current_role_datasource"
SequenceResource feature = "snowflake_sequence_resource"
SequencesDatasource feature = "snowflake_sequences_datasource"
ShareResource feature = "snowflake_share_resource"
SharesDatasource feature = "snowflake_shares_datasource"
ParametersDatasource feature = "snowflake_parameters_datasource"
StageResource feature = "snowflake_stage_resource"
StagesDatasource feature = "snowflake_stages_datasource"
StorageIntegrationResource feature = "snowflake_storage_integration_resource"
StorageIntegrationsDatasource feature = "snowflake_storage_integrations_datasource"
SystemGenerateSCIMAccessTokenDatasource feature = "snowflake_system_generate_scim_access_token_datasource"
SystemGetAWSSNSIAMPolicyDatasource feature = "snowflake_system_get_aws_sns_iam_policy_datasource"
SystemGetPrivateLinkConfigDatasource feature = "snowflake_system_get_privatelink_config_datasource"
SystemGetSnowflakePlatformInfoDatasource feature = "snowflake_system_get_snowflake_platform_info_datasource"
TableResource feature = "snowflake_table_resource"
TablesDatasource feature = "snowflake_tables_datasource"
TableColumnMaskingPolicyApplicationResource feature = "snowflake_table_column_masking_policy_application_resource"
TableConstraintResource feature = "snowflake_table_constraint_resource"
UserAuthenticationPolicyAttachmentResource feature = "snowflake_user_authentication_policy_attachment_resource"
UserPublicKeysResource feature = "snowflake_user_public_keys_resource"
UserPasswordPolicyAttachmentResource feature = "snowflake_user_password_policy_attachment_resource"
)

var allPreviewFeatures = []feature{
CurrentAccountDatasource,
AccountAuthenticationPolicyAttachmentResource,
AccountPasswordPolicyAttachmentResource,
AlertResource,
AlertsDatasource,
ApiIntegrationResource,
AuthenticationPolicyResource,
CortexSearchServiceResource,
CortexSearchServicesDatasource,
DatabaseDatasource,
Expand Down
7 changes: 4 additions & 3 deletions pkg/resources/account_authentication_policy_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"

Expand All @@ -29,9 +30,9 @@ func AccountAuthenticationPolicyAttachment() *schema.Resource {
return &schema.Resource{
Description: "Specifies the authentication policy to use for the current account. To set the authentication policy of a different account, use a provider alias.",

CreateContext: TrackingCreateWrapper(resources.AccountAuthenticationPolicyAttachment, CreateAccountAuthenticationPolicyAttachment),
ReadContext: TrackingReadWrapper(resources.AccountAuthenticationPolicyAttachment, ReadAccountAuthenticationPolicyAttachment),
DeleteContext: TrackingDeleteWrapper(resources.AccountAuthenticationPolicyAttachment, DeleteAccountAuthenticationPolicyAttachment),
CreateContext: PreviewFeatureCreateContextWrapper(string(previewfeatures.AccountAuthenticationPolicyAttachmentResource), TrackingCreateWrapper(resources.AccountAuthenticationPolicyAttachment, CreateAccountAuthenticationPolicyAttachment)),
ReadContext: PreviewFeatureReadContextWrapper(string(previewfeatures.AccountAuthenticationPolicyAttachmentResource), TrackingReadWrapper(resources.AccountAuthenticationPolicyAttachment, ReadAccountAuthenticationPolicyAttachment)),
DeleteContext: PreviewFeatureDeleteContextWrapper(string(previewfeatures.AccountAuthenticationPolicyAttachmentResource), TrackingDeleteWrapper(resources.AccountAuthenticationPolicyAttachment, DeleteAccountAuthenticationPolicyAttachment)),

Schema: accountAuthenticationPolicyAttachmentSchema,
Importer: &schema.ResourceImporter{
Expand Down
9 changes: 5 additions & 4 deletions pkg/resources/authentication_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"reflect"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
Expand Down Expand Up @@ -110,10 +111,10 @@ var authenticationPolicySchema = map[string]*schema.Schema{
// AuthenticationPolicy returns a pointer to the resource representing an authentication policy.
func AuthenticationPolicy() *schema.Resource {
return &schema.Resource{
CreateContext: TrackingCreateWrapper(resources.AuthenticationPolicy, CreateContextAuthenticationPolicy),
ReadContext: TrackingReadWrapper(resources.AuthenticationPolicy, ReadContextAuthenticationPolicy),
UpdateContext: TrackingUpdateWrapper(resources.AuthenticationPolicy, UpdateContextAuthenticationPolicy),
DeleteContext: TrackingDeleteWrapper(resources.AuthenticationPolicy, DeleteContextAuthenticationPolicy),
CreateContext: PreviewFeatureCreateContextWrapper(string(previewfeatures.AuthenticationPolicyResource), TrackingCreateWrapper(resources.AuthenticationPolicy, CreateContextAuthenticationPolicy)),
ReadContext: PreviewFeatureReadContextWrapper(string(previewfeatures.AuthenticationPolicyResource), TrackingReadWrapper(resources.AuthenticationPolicy, ReadContextAuthenticationPolicy)),
UpdateContext: PreviewFeatureUpdateContextWrapper(string(previewfeatures.AuthenticationPolicyResource), TrackingUpdateWrapper(resources.AuthenticationPolicy, UpdateContextAuthenticationPolicy)),
DeleteContext: PreviewFeatureDeleteContextWrapper(string(previewfeatures.AuthenticationPolicyResource), TrackingDeleteWrapper(resources.AuthenticationPolicy, DeleteContextAuthenticationPolicy)),
Description: "Resource used to manage authentication policy objects. For more information, check [authentication policy documentation](https://docs.snowflake.com/en/sql-reference/sql/create-authentication-policy).",

Schema: authenticationPolicySchema,
Expand Down
9 changes: 5 additions & 4 deletions pkg/resources/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/provider"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/previewfeatures"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/provider/resources"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/schemas"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
Expand Down Expand Up @@ -208,10 +209,10 @@ var tableSchema = map[string]*schema.Schema{

func Table() *schema.Resource {
return &schema.Resource{
CreateContext: TrackingCreateWrapper(resources.Table, CreateTable),
ReadContext: TrackingReadWrapper(resources.Table, ReadTable),
UpdateContext: TrackingUpdateWrapper(resources.Table, UpdateTable),
DeleteContext: TrackingDeleteWrapper(resources.Table, DeleteTable),
CreateContext: PreviewFeatureCreateContextWrapper(string(previewfeatures.TableResource), TrackingCreateWrapper(resources.Table, CreateTable)),
ReadContext: PreviewFeatureReadContextWrapper(string(previewfeatures.TableResource), TrackingReadWrapper(resources.Table, ReadTable)),
UpdateContext: PreviewFeatureUpdateContextWrapper(string(previewfeatures.TableResource), TrackingUpdateWrapper(resources.Table, UpdateTable)),
DeleteContext: PreviewFeatureDeleteContextWrapper(string(previewfeatures.TableResource), TrackingDeleteWrapper(resources.Table, DeleteTable)),

CustomizeDiff: TrackingCustomDiffWrapper(resources.Table, customdiff.All(
ComputedIfAnyAttributeChanged(tableSchema, FullyQualifiedNameAttributeName, "name"),
Expand Down
2 changes: 2 additions & 0 deletions v1-preparations/LIST_OF_PREVIEW_FEATURES_FOR_V1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

* [snowflake_current_account](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/data-sources/current_account) (datasource)
* [snowflake_account_password_policy_attachment](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/account_password_policy_attachment)
* [snowflake_account_authentication_policy_attachment](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/account_authentication_policy_attachment)
* [snowflake_alert](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/alert)
* [snowflake_alerts](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/data-sources/alerts) (datasource)
* [snowflake_authentication_policy](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/authentication_policy)
* [snowflake_api_integration](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/api_integration)
* [snowflake_cortex_search_service](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/cortex_search_service)
* [snowflake_cortex_search_services](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/data-sources/cortex_search_services) (datasource)
Expand Down

0 comments on commit 7c302ac

Please sign in to comment.