diff --git a/internal/provider/example_data_source.go b/internal/provider/example_data_source.go index 585b9d2..00fdb3f 100644 --- a/internal/provider/example_data_source.go +++ b/internal/provider/example_data_source.go @@ -6,7 +6,6 @@ package provider import ( "context" "fmt" - "net/http" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -23,7 +22,7 @@ func NewExampleDataSource() datasource.DataSource { // ExampleDataSource defines the data source implementation. type ExampleDataSource struct { - client *http.Client + data *CoderdProviderData } // ExampleDataSourceModel describes the data source data model. @@ -60,18 +59,18 @@ func (d *ExampleDataSource) Configure(ctx context.Context, req datasource.Config return } - client, ok := req.ProviderData.(*http.Client) + client, ok := req.ProviderData.(*CoderdProviderData) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *CoderdProviderData, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.data = client } func (d *ExampleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { diff --git a/internal/provider/example_data_source_test.go b/internal/provider/example_data_source_test.go index 4b66984..e29d806 100644 --- a/internal/provider/example_data_source_test.go +++ b/internal/provider/example_data_source_test.go @@ -26,6 +26,11 @@ func TestAccExampleDataSource(t *testing.T) { } const testAccExampleDataSourceConfig = ` +provider coderd { + url = "https://dev.coder.com" + token = "iamnotarealtoken" +} + data "coderd_example" "test" { configurable_attribute = "example" } diff --git a/internal/provider/user_resource.go b/internal/provider/user_resource.go index a3690f8..01c4fd5 100644 --- a/internal/provider/user_resource.go +++ b/internal/provider/user_resource.go @@ -135,7 +135,7 @@ func (r *UserResource) Configure(ctx context.Context, req resource.ConfigureRequ if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *codersdk.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *CoderdProviderData, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return