From 21d27885dc4a82264bf3f74d4bbd598e223e6684 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 14 Nov 2024 14:00:15 +0100 Subject: [PATCH] Upgrade TF provider to 1.58.0 (#1900) ## Changes Notable changes: * Adds support for `restart_window` for pipelines. * Fix drift for pipelines where `catalog` contains uppercase characters. * Better error message if single-node job clusters are incorrectly configured. See: * https://github.com/databricks/terraform-provider-databricks/releases/tag/v1.58.0 * https://github.com/databricks/terraform-provider-databricks/releases/tag/v1.57.0 * https://github.com/databricks/terraform-provider-databricks/releases/tag/v1.56.0 * https://github.com/databricks/terraform-provider-databricks/releases/tag/v1.55.0 ## Tests Integration tests pass. --- bundle/internal/tf/codegen/schema/version.go | 2 +- .../tf/schema/data_source_functions.go | 98 +++++++++++++++++++ .../schema/data_source_storage_credential.go | 1 + .../internal/tf/schema/data_source_volumes.go | 1 - bundle/internal/tf/schema/data_sources.go | 2 + bundle/internal/tf/schema/resource_alert.go | 46 +++++++++ .../schema/resource_custom_app_integration.go | 23 +++++ bundle/internal/tf/schema/resource_library.go | 18 ++-- .../internal/tf/schema/resource_pipeline.go | 8 ++ bundle/internal/tf/schema/resource_query.go | 84 ++++++++++++++++ bundle/internal/tf/schema/resources.go | 6 ++ bundle/internal/tf/schema/root.go | 2 +- 12 files changed, 279 insertions(+), 12 deletions(-) create mode 100644 bundle/internal/tf/schema/data_source_functions.go create mode 100644 bundle/internal/tf/schema/resource_alert.go create mode 100644 bundle/internal/tf/schema/resource_custom_app_integration.go create mode 100644 bundle/internal/tf/schema/resource_query.go diff --git a/bundle/internal/tf/codegen/schema/version.go b/bundle/internal/tf/codegen/schema/version.go index 0c424408..cfbc46c0 100644 --- a/bundle/internal/tf/codegen/schema/version.go +++ b/bundle/internal/tf/codegen/schema/version.go @@ -1,3 +1,3 @@ package schema -const ProviderVersion = "1.54.0" +const ProviderVersion = "1.58.0" diff --git a/bundle/internal/tf/schema/data_source_functions.go b/bundle/internal/tf/schema/data_source_functions.go new file mode 100644 index 00000000..6085d752 --- /dev/null +++ b/bundle/internal/tf/schema/data_source_functions.go @@ -0,0 +1,98 @@ +// Generated from Databricks Terraform provider schema. DO NOT EDIT. + +package schema + +type DataSourceFunctionsFunctionsInputParamsParameters struct { + Comment string `json:"comment,omitempty"` + Name string `json:"name"` + ParameterDefault string `json:"parameter_default,omitempty"` + ParameterMode string `json:"parameter_mode,omitempty"` + ParameterType string `json:"parameter_type,omitempty"` + Position int `json:"position"` + TypeIntervalType string `json:"type_interval_type,omitempty"` + TypeJson string `json:"type_json,omitempty"` + TypeName string `json:"type_name"` + TypePrecision int `json:"type_precision,omitempty"` + TypeScale int `json:"type_scale,omitempty"` + TypeText string `json:"type_text"` +} + +type DataSourceFunctionsFunctionsInputParams struct { + Parameters []DataSourceFunctionsFunctionsInputParamsParameters `json:"parameters,omitempty"` +} + +type DataSourceFunctionsFunctionsReturnParamsParameters struct { + Comment string `json:"comment,omitempty"` + Name string `json:"name"` + ParameterDefault string `json:"parameter_default,omitempty"` + ParameterMode string `json:"parameter_mode,omitempty"` + ParameterType string `json:"parameter_type,omitempty"` + Position int `json:"position"` + TypeIntervalType string `json:"type_interval_type,omitempty"` + TypeJson string `json:"type_json,omitempty"` + TypeName string `json:"type_name"` + TypePrecision int `json:"type_precision,omitempty"` + TypeScale int `json:"type_scale,omitempty"` + TypeText string `json:"type_text"` +} + +type DataSourceFunctionsFunctionsReturnParams struct { + Parameters []DataSourceFunctionsFunctionsReturnParamsParameters `json:"parameters,omitempty"` +} + +type DataSourceFunctionsFunctionsRoutineDependenciesDependenciesFunction struct { + FunctionFullName string `json:"function_full_name"` +} + +type DataSourceFunctionsFunctionsRoutineDependenciesDependenciesTable struct { + TableFullName string `json:"table_full_name"` +} + +type DataSourceFunctionsFunctionsRoutineDependenciesDependencies struct { + Function []DataSourceFunctionsFunctionsRoutineDependenciesDependenciesFunction `json:"function,omitempty"` + Table []DataSourceFunctionsFunctionsRoutineDependenciesDependenciesTable `json:"table,omitempty"` +} + +type DataSourceFunctionsFunctionsRoutineDependencies struct { + Dependencies []DataSourceFunctionsFunctionsRoutineDependenciesDependencies `json:"dependencies,omitempty"` +} + +type DataSourceFunctionsFunctions struct { + BrowseOnly bool `json:"browse_only,omitempty"` + CatalogName string `json:"catalog_name,omitempty"` + Comment string `json:"comment,omitempty"` + CreatedAt int `json:"created_at,omitempty"` + CreatedBy string `json:"created_by,omitempty"` + DataType string `json:"data_type,omitempty"` + ExternalLanguage string `json:"external_language,omitempty"` + ExternalName string `json:"external_name,omitempty"` + FullDataType string `json:"full_data_type,omitempty"` + FullName string `json:"full_name,omitempty"` + FunctionId string `json:"function_id,omitempty"` + IsDeterministic bool `json:"is_deterministic,omitempty"` + IsNullCall bool `json:"is_null_call,omitempty"` + MetastoreId string `json:"metastore_id,omitempty"` + Name string `json:"name,omitempty"` + Owner string `json:"owner,omitempty"` + ParameterStyle string `json:"parameter_style,omitempty"` + Properties string `json:"properties,omitempty"` + RoutineBody string `json:"routine_body,omitempty"` + RoutineDefinition string `json:"routine_definition,omitempty"` + SchemaName string `json:"schema_name,omitempty"` + SecurityType string `json:"security_type,omitempty"` + SpecificName string `json:"specific_name,omitempty"` + SqlDataAccess string `json:"sql_data_access,omitempty"` + SqlPath string `json:"sql_path,omitempty"` + UpdatedAt int `json:"updated_at,omitempty"` + UpdatedBy string `json:"updated_by,omitempty"` + InputParams []DataSourceFunctionsFunctionsInputParams `json:"input_params,omitempty"` + ReturnParams []DataSourceFunctionsFunctionsReturnParams `json:"return_params,omitempty"` + RoutineDependencies []DataSourceFunctionsFunctionsRoutineDependencies `json:"routine_dependencies,omitempty"` +} + +type DataSourceFunctions struct { + CatalogName string `json:"catalog_name"` + IncludeBrowse bool `json:"include_browse,omitempty"` + SchemaName string `json:"schema_name"` + Functions []DataSourceFunctionsFunctions `json:"functions,omitempty"` +} diff --git a/bundle/internal/tf/schema/data_source_storage_credential.go b/bundle/internal/tf/schema/data_source_storage_credential.go index bf58f272..95c1afcd 100644 --- a/bundle/internal/tf/schema/data_source_storage_credential.go +++ b/bundle/internal/tf/schema/data_source_storage_credential.go @@ -35,6 +35,7 @@ type DataSourceStorageCredentialStorageCredentialInfo struct { Comment string `json:"comment,omitempty"` CreatedAt int `json:"created_at,omitempty"` CreatedBy string `json:"created_by,omitempty"` + FullName string `json:"full_name,omitempty"` Id string `json:"id,omitempty"` IsolationMode string `json:"isolation_mode,omitempty"` MetastoreId string `json:"metastore_id,omitempty"` diff --git a/bundle/internal/tf/schema/data_source_volumes.go b/bundle/internal/tf/schema/data_source_volumes.go index 07bf5933..cafc9e68 100644 --- a/bundle/internal/tf/schema/data_source_volumes.go +++ b/bundle/internal/tf/schema/data_source_volumes.go @@ -4,7 +4,6 @@ package schema type DataSourceVolumes struct { CatalogName string `json:"catalog_name"` - Id string `json:"id,omitempty"` Ids []string `json:"ids,omitempty"` SchemaName string `json:"schema_name"` } diff --git a/bundle/internal/tf/schema/data_sources.go b/bundle/internal/tf/schema/data_sources.go index 050e0bc1..e32609b0 100644 --- a/bundle/internal/tf/schema/data_sources.go +++ b/bundle/internal/tf/schema/data_sources.go @@ -21,6 +21,7 @@ type DataSources struct { Directory map[string]any `json:"databricks_directory,omitempty"` ExternalLocation map[string]any `json:"databricks_external_location,omitempty"` ExternalLocations map[string]any `json:"databricks_external_locations,omitempty"` + Functions map[string]any `json:"databricks_functions,omitempty"` Group map[string]any `json:"databricks_group,omitempty"` InstancePool map[string]any `json:"databricks_instance_pool,omitempty"` InstanceProfiles map[string]any `json:"databricks_instance_profiles,omitempty"` @@ -79,6 +80,7 @@ func NewDataSources() *DataSources { Directory: make(map[string]any), ExternalLocation: make(map[string]any), ExternalLocations: make(map[string]any), + Functions: make(map[string]any), Group: make(map[string]any), InstancePool: make(map[string]any), InstanceProfiles: make(map[string]any), diff --git a/bundle/internal/tf/schema/resource_alert.go b/bundle/internal/tf/schema/resource_alert.go new file mode 100644 index 00000000..c539d5fe --- /dev/null +++ b/bundle/internal/tf/schema/resource_alert.go @@ -0,0 +1,46 @@ +// Generated from Databricks Terraform provider schema. DO NOT EDIT. + +package schema + +type ResourceAlertConditionOperandColumn struct { + Name string `json:"name"` +} + +type ResourceAlertConditionOperand struct { + Column *ResourceAlertConditionOperandColumn `json:"column,omitempty"` +} + +type ResourceAlertConditionThresholdValue struct { + BoolValue bool `json:"bool_value,omitempty"` + DoubleValue int `json:"double_value,omitempty"` + StringValue string `json:"string_value,omitempty"` +} + +type ResourceAlertConditionThreshold struct { + Value *ResourceAlertConditionThresholdValue `json:"value,omitempty"` +} + +type ResourceAlertCondition struct { + EmptyResultState string `json:"empty_result_state,omitempty"` + Op string `json:"op"` + Operand *ResourceAlertConditionOperand `json:"operand,omitempty"` + Threshold *ResourceAlertConditionThreshold `json:"threshold,omitempty"` +} + +type ResourceAlert struct { + CreateTime string `json:"create_time,omitempty"` + CustomBody string `json:"custom_body,omitempty"` + CustomSubject string `json:"custom_subject,omitempty"` + DisplayName string `json:"display_name"` + Id string `json:"id,omitempty"` + LifecycleState string `json:"lifecycle_state,omitempty"` + NotifyOnOk bool `json:"notify_on_ok,omitempty"` + OwnerUserName string `json:"owner_user_name,omitempty"` + ParentPath string `json:"parent_path,omitempty"` + QueryId string `json:"query_id"` + SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` + State string `json:"state,omitempty"` + TriggerTime string `json:"trigger_time,omitempty"` + UpdateTime string `json:"update_time,omitempty"` + Condition *ResourceAlertCondition `json:"condition,omitempty"` +} diff --git a/bundle/internal/tf/schema/resource_custom_app_integration.go b/bundle/internal/tf/schema/resource_custom_app_integration.go new file mode 100644 index 00000000..e89eb7fe --- /dev/null +++ b/bundle/internal/tf/schema/resource_custom_app_integration.go @@ -0,0 +1,23 @@ +// Generated from Databricks Terraform provider schema. DO NOT EDIT. + +package schema + +type ResourceCustomAppIntegrationTokenAccessPolicy struct { + AccessTokenTtlInMinutes int `json:"access_token_ttl_in_minutes,omitempty"` + RefreshTokenTtlInMinutes int `json:"refresh_token_ttl_in_minutes,omitempty"` +} + +type ResourceCustomAppIntegration struct { + ClientId string `json:"client_id,omitempty"` + ClientSecret string `json:"client_secret,omitempty"` + Confidential bool `json:"confidential,omitempty"` + CreateTime string `json:"create_time,omitempty"` + CreatedBy int `json:"created_by,omitempty"` + CreatorUsername string `json:"creator_username,omitempty"` + Id string `json:"id,omitempty"` + IntegrationId string `json:"integration_id,omitempty"` + Name string `json:"name,omitempty"` + RedirectUrls []string `json:"redirect_urls,omitempty"` + Scopes []string `json:"scopes,omitempty"` + TokenAccessPolicy *ResourceCustomAppIntegrationTokenAccessPolicy `json:"token_access_policy,omitempty"` +} diff --git a/bundle/internal/tf/schema/resource_library.go b/bundle/internal/tf/schema/resource_library.go index 385d992d..4fad7dbd 100644 --- a/bundle/internal/tf/schema/resource_library.go +++ b/bundle/internal/tf/schema/resource_library.go @@ -19,13 +19,13 @@ type ResourceLibraryPypi struct { } type ResourceLibrary struct { - ClusterId string `json:"cluster_id"` - Egg string `json:"egg,omitempty"` - Id string `json:"id,omitempty"` - Jar string `json:"jar,omitempty"` - Requirements string `json:"requirements,omitempty"` - Whl string `json:"whl,omitempty"` - Cran *ResourceLibraryCran `json:"cran,omitempty"` - Maven *ResourceLibraryMaven `json:"maven,omitempty"` - Pypi *ResourceLibraryPypi `json:"pypi,omitempty"` + ClusterId string `json:"cluster_id"` + Egg string `json:"egg,omitempty"` + Id string `json:"id,omitempty"` + Jar string `json:"jar,omitempty"` + Requirements string `json:"requirements,omitempty"` + Whl string `json:"whl,omitempty"` + Cran []ResourceLibraryCran `json:"cran,omitempty"` + Maven []ResourceLibraryMaven `json:"maven,omitempty"` + Pypi []ResourceLibraryPypi `json:"pypi,omitempty"` } diff --git a/bundle/internal/tf/schema/resource_pipeline.go b/bundle/internal/tf/schema/resource_pipeline.go index 2cb459ab..7238d24a 100644 --- a/bundle/internal/tf/schema/resource_pipeline.go +++ b/bundle/internal/tf/schema/resource_pipeline.go @@ -137,6 +137,7 @@ type ResourcePipelineFilters struct { type ResourcePipelineGatewayDefinition struct { ConnectionId string `json:"connection_id,omitempty"` + ConnectionName string `json:"connection_name,omitempty"` GatewayStorageCatalog string `json:"gateway_storage_catalog,omitempty"` GatewayStorageName string `json:"gateway_storage_name,omitempty"` GatewayStorageSchema string `json:"gateway_storage_schema,omitempty"` @@ -242,6 +243,12 @@ type ResourcePipelineNotification struct { EmailRecipients []string `json:"email_recipients,omitempty"` } +type ResourcePipelineRestartWindow struct { + DaysOfWeek string `json:"days_of_week,omitempty"` + StartHour int `json:"start_hour"` + TimeZoneId string `json:"time_zone_id,omitempty"` +} + type ResourcePipelineTriggerCron struct { QuartzCronSchedule string `json:"quartz_cron_schedule,omitempty"` TimezoneId string `json:"timezone_id,omitempty"` @@ -288,5 +295,6 @@ type ResourcePipeline struct { LatestUpdates []ResourcePipelineLatestUpdates `json:"latest_updates,omitempty"` Library []ResourcePipelineLibrary `json:"library,omitempty"` Notification []ResourcePipelineNotification `json:"notification,omitempty"` + RestartWindow *ResourcePipelineRestartWindow `json:"restart_window,omitempty"` Trigger *ResourcePipelineTrigger `json:"trigger,omitempty"` } diff --git a/bundle/internal/tf/schema/resource_query.go b/bundle/internal/tf/schema/resource_query.go new file mode 100644 index 00000000..dc8e517c --- /dev/null +++ b/bundle/internal/tf/schema/resource_query.go @@ -0,0 +1,84 @@ +// Generated from Databricks Terraform provider schema. DO NOT EDIT. + +package schema + +type ResourceQueryParameterDateRangeValueDateRangeValue struct { + End string `json:"end"` + Start string `json:"start"` +} + +type ResourceQueryParameterDateRangeValue struct { + DynamicDateRangeValue string `json:"dynamic_date_range_value,omitempty"` + Precision string `json:"precision,omitempty"` + StartDayOfWeek int `json:"start_day_of_week,omitempty"` + DateRangeValue *ResourceQueryParameterDateRangeValueDateRangeValue `json:"date_range_value,omitempty"` +} + +type ResourceQueryParameterDateValue struct { + DateValue string `json:"date_value,omitempty"` + DynamicDateValue string `json:"dynamic_date_value,omitempty"` + Precision string `json:"precision,omitempty"` +} + +type ResourceQueryParameterEnumValueMultiValuesOptions struct { + Prefix string `json:"prefix,omitempty"` + Separator string `json:"separator,omitempty"` + Suffix string `json:"suffix,omitempty"` +} + +type ResourceQueryParameterEnumValue struct { + EnumOptions string `json:"enum_options,omitempty"` + Values []string `json:"values,omitempty"` + MultiValuesOptions *ResourceQueryParameterEnumValueMultiValuesOptions `json:"multi_values_options,omitempty"` +} + +type ResourceQueryParameterNumericValue struct { + Value int `json:"value"` +} + +type ResourceQueryParameterQueryBackedValueMultiValuesOptions struct { + Prefix string `json:"prefix,omitempty"` + Separator string `json:"separator,omitempty"` + Suffix string `json:"suffix,omitempty"` +} + +type ResourceQueryParameterQueryBackedValue struct { + QueryId string `json:"query_id"` + Values []string `json:"values,omitempty"` + MultiValuesOptions *ResourceQueryParameterQueryBackedValueMultiValuesOptions `json:"multi_values_options,omitempty"` +} + +type ResourceQueryParameterTextValue struct { + Value string `json:"value"` +} + +type ResourceQueryParameter struct { + Name string `json:"name"` + Title string `json:"title,omitempty"` + DateRangeValue *ResourceQueryParameterDateRangeValue `json:"date_range_value,omitempty"` + DateValue *ResourceQueryParameterDateValue `json:"date_value,omitempty"` + EnumValue *ResourceQueryParameterEnumValue `json:"enum_value,omitempty"` + NumericValue *ResourceQueryParameterNumericValue `json:"numeric_value,omitempty"` + QueryBackedValue *ResourceQueryParameterQueryBackedValue `json:"query_backed_value,omitempty"` + TextValue *ResourceQueryParameterTextValue `json:"text_value,omitempty"` +} + +type ResourceQuery struct { + ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` + Catalog string `json:"catalog,omitempty"` + CreateTime string `json:"create_time,omitempty"` + Description string `json:"description,omitempty"` + DisplayName string `json:"display_name"` + Id string `json:"id,omitempty"` + LastModifierUserName string `json:"last_modifier_user_name,omitempty"` + LifecycleState string `json:"lifecycle_state,omitempty"` + OwnerUserName string `json:"owner_user_name,omitempty"` + ParentPath string `json:"parent_path,omitempty"` + QueryText string `json:"query_text"` + RunAsMode string `json:"run_as_mode,omitempty"` + Schema string `json:"schema,omitempty"` + Tags []string `json:"tags,omitempty"` + UpdateTime string `json:"update_time,omitempty"` + WarehouseId string `json:"warehouse_id"` + Parameter []ResourceQueryParameter `json:"parameter,omitempty"` +} diff --git a/bundle/internal/tf/schema/resources.go b/bundle/internal/tf/schema/resources.go index 53f558df..ea5b618f 100644 --- a/bundle/internal/tf/schema/resources.go +++ b/bundle/internal/tf/schema/resources.go @@ -4,6 +4,7 @@ package schema type Resources struct { AccessControlRuleSet map[string]any `json:"databricks_access_control_rule_set,omitempty"` + Alert map[string]any `json:"databricks_alert,omitempty"` ArtifactAllowlist map[string]any `json:"databricks_artifact_allowlist,omitempty"` AutomaticClusterUpdateWorkspaceSetting map[string]any `json:"databricks_automatic_cluster_update_workspace_setting,omitempty"` AwsS3Mount map[string]any `json:"databricks_aws_s3_mount,omitempty"` @@ -17,6 +18,7 @@ type Resources struct { ClusterPolicy map[string]any `json:"databricks_cluster_policy,omitempty"` ComplianceSecurityProfileWorkspaceSetting map[string]any `json:"databricks_compliance_security_profile_workspace_setting,omitempty"` Connection map[string]any `json:"databricks_connection,omitempty"` + CustomAppIntegration map[string]any `json:"databricks_custom_app_integration,omitempty"` Dashboard map[string]any `json:"databricks_dashboard,omitempty"` DbfsFile map[string]any `json:"databricks_dbfs_file,omitempty"` DefaultNamespaceSetting map[string]any `json:"databricks_default_namespace_setting,omitempty"` @@ -68,6 +70,7 @@ type Resources struct { Pipeline map[string]any `json:"databricks_pipeline,omitempty"` Provider map[string]any `json:"databricks_provider,omitempty"` QualityMonitor map[string]any `json:"databricks_quality_monitor,omitempty"` + Query map[string]any `json:"databricks_query,omitempty"` Recipient map[string]any `json:"databricks_recipient,omitempty"` RegisteredModel map[string]any `json:"databricks_registered_model,omitempty"` Repo map[string]any `json:"databricks_repo,omitempty"` @@ -107,6 +110,7 @@ type Resources struct { func NewResources() *Resources { return &Resources{ AccessControlRuleSet: make(map[string]any), + Alert: make(map[string]any), ArtifactAllowlist: make(map[string]any), AutomaticClusterUpdateWorkspaceSetting: make(map[string]any), AwsS3Mount: make(map[string]any), @@ -120,6 +124,7 @@ func NewResources() *Resources { ClusterPolicy: make(map[string]any), ComplianceSecurityProfileWorkspaceSetting: make(map[string]any), Connection: make(map[string]any), + CustomAppIntegration: make(map[string]any), Dashboard: make(map[string]any), DbfsFile: make(map[string]any), DefaultNamespaceSetting: make(map[string]any), @@ -171,6 +176,7 @@ func NewResources() *Resources { Pipeline: make(map[string]any), Provider: make(map[string]any), QualityMonitor: make(map[string]any), + Query: make(map[string]any), Recipient: make(map[string]any), RegisteredModel: make(map[string]any), Repo: make(map[string]any), diff --git a/bundle/internal/tf/schema/root.go b/bundle/internal/tf/schema/root.go index bf4283c9..7ccb7a0f 100644 --- a/bundle/internal/tf/schema/root.go +++ b/bundle/internal/tf/schema/root.go @@ -21,7 +21,7 @@ type Root struct { const ProviderHost = "registry.terraform.io" const ProviderSource = "databricks/databricks" -const ProviderVersion = "1.54.0" +const ProviderVersion = "1.58.0" func NewRoot() *Root { return &Root{