Skip to content

Commit

Permalink
added resource to rollout utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomez04 committed Nov 1, 2024
1 parent 88608c1 commit 26c69fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
19 changes: 1 addition & 18 deletions internal/providers/pluginfw/pluginfw.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ import (
"github.com/databricks/terraform-provider-databricks/commands"
"github.com/databricks/terraform-provider-databricks/common"
providercommon "github.com/databricks/terraform-provider-databricks/internal/providers/common"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/catalog"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/cluster"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/notificationdestinations"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/registered_model"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/sharing"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/user"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/volume"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
Expand All @@ -50,16 +42,7 @@ func (p *DatabricksProviderPluginFramework) Resources(ctx context.Context) []fun
}

func (p *DatabricksProviderPluginFramework) DataSources(ctx context.Context) []func() datasource.DataSource {
return []func() datasource.DataSource{
cluster.DataSourceCluster,
volume.DataSourceVolumes,
registered_model.DataSourceRegisteredModel,
notificationdestinations.DataSourceNotificationDestinations,
sharing.DataSourceShare,
sharing.DataSourceShares,
catalog.DataSourceFunctions,
user.DataSourceUsers,
}
return getPluginFrameworkDataSourcesToRegister(p.sdkV2Fallbacks...)
}

func (p *DatabricksProviderPluginFramework) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
Expand Down
2 changes: 2 additions & 0 deletions internal/providers/pluginfw/pluginfw_rollout_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/qualitymonitor"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/registered_model"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/sharing"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/user"
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/resources/volume"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/resource"
Expand All @@ -45,6 +46,7 @@ var pluginFwOnlyResources = []func() resource.Resource{
var pluginFwOnlyDataSources = []func() datasource.DataSource{
registered_model.DataSourceRegisteredModel,
notificationdestinations.DataSourceNotificationDestinations,
user.DataSourceUsers,
catalog.DataSourceFunctions,
// TODO: Add DataSourceCluster into migratedDataSources after fixing unit tests.
cluster.DataSourceCluster, // Using the staging name (with pluginframework suffix)
Expand Down
4 changes: 3 additions & 1 deletion internal/providers/pluginfw/resources/user/data_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

const dataSourceName = "users"

func DataSourceUsers() datasource.DataSource {
return &UsersDataSource{}
}
Expand All @@ -30,7 +32,7 @@ type UsersInfo struct {
}

func (d *UsersDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
resp.TypeName = "databricks_users"
resp.TypeName = pluginfwcommon.GetDatabricksProductionName(dataSourceName)
}

func (d *UsersDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

const dataSourceTemplate = `
resource "databricks_user" "user1" {
user_name = "user-datasource-{var.STICKY_RANDOM}[email protected]"
user_name = "tf-{var.STICKY_RANDOM}[email protected]"
}
resource "databricks_user" "user2" {
user_name = "user-datasource-{var.STICKY_RANDOM}[email protected]"
user_name = "tf-{var.STICKY_RANDOM}[email protected]"
}
data "databricks_users" "this" {
Expand Down

0 comments on commit 26c69fb

Please sign in to comment.