Skip to content

Commit

Permalink
Enable "system" datasources
Browse files Browse the repository at this point in the history
Allow creating "system" datasources when the experimental build tag
is set.
  • Loading branch information
stuart-mclaren-hpe committed Aug 22, 2024
1 parent f3e2aa0 commit 40dbe7f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
18 changes: 18 additions & 0 deletions internal/provider/datasources.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// (C) Copyright 2024 Hewlett Packard Enterprise Development LP

//go:build !experimental

package provider

import (
"context"

"github.com/hashicorp/terraform-plugin-framework/datasource"
)

// DataSources defines the data sources implemented in the provider.
func (p *PCBeProvider) DataSources(
_ context.Context,
) []func() datasource.DataSource {
return []func() datasource.DataSource{}
}
20 changes: 20 additions & 0 deletions internal/provider/experimental_datasources.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// (C) Copyright 2024 Hewlett Packard Enterprise Development LP

//go:build experimental

package provider

import (
"context"
"github.com/HewlettPackard/hpegl-pcbe-terraform-resources/internal/datasources/system"
"github.com/hashicorp/terraform-plugin-framework/datasource"
)

// DataSources defines the data sources implemented in the provider.
func (p *PCBeProvider) DataSources(
_ context.Context,
) []func() datasource.DataSource {
return []func() datasource.DataSource{
system.NewDataSource,
}
}
8 changes: 0 additions & 8 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/HewlettPackard/hpegl-pcbe-terraform-resources/internal/client"
"github.com/HewlettPackard/hpegl-pcbe-terraform-resources/internal/constants"
"github.com/HewlettPackard/hpegl-pcbe-terraform-resources/internal/defaults"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/provider"
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
Expand Down Expand Up @@ -169,13 +168,6 @@ func (p *PCBeProvider) Configure(
resp.ResourceData = client
}

// DataSources defines the data sources implemented in the provider.
func (p *PCBeProvider) DataSources(
_ context.Context,
) []func() datasource.DataSource {
return []func() datasource.DataSource{}
}

// Resources defines the resources implemented in the provider.
func (p *PCBeProvider) Resources(
_ context.Context,
Expand Down

0 comments on commit 40dbe7f

Please sign in to comment.