Skip to content

Commit 1c9315d

Browse files
authored
Check cloud configuration and check to ensure that the datasource implements the interfaces (#1999)
1 parent b693f04 commit 1c9315d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

internal/resources/cloud/common.go

+9
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ func (r *basePluginFrameworkDataSource) Configure(ctx context.Context, req datas
7171
return
7272
}
7373

74+
if client.GrafanaCloudAPI == nil {
75+
resp.Diagnostics.AddError(
76+
"The Grafana Provider is missing a configuration for the Grafana Cloud API.",
77+
"Please ensure that cloud_api_url and cloud_access_policy_token are set in the provider configuration.",
78+
)
79+
80+
return
81+
}
82+
7483
r.client = client.GrafanaCloudAPI
7584
}
7685

internal/resources/cloud/data_source_cloud_access_policies.go

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/hashicorp/terraform-plugin-framework/types"
1212
)
1313

14+
var _ datasource.DataSource = &AccessPoliciesDataSource{}
15+
var _ datasource.DataSourceWithConfigure = &AccessPoliciesDataSource{}
16+
1417
var dataSourceAccessPoliciesName = "grafana_cloud_access_policies"
1518

1619
func datasourceAccessPolicies() *common.DataSource {

internal/resources/cloud/data_source_private_data_source_connect_network.go

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
"github.com/hashicorp/terraform-plugin-framework/types"
1313
)
1414

15+
var _ datasource.DataSource = &PDCNetworksDataSource{}
16+
var _ datasource.DataSourceWithConfigure = &PDCNetworksDataSource{}
17+
1518
var dataSourcePrivateDataSourceConnectNetworksName = "grafana_cloud_private_data_source_connect_networks"
1619

1720
func datasourcePrivateDataSourceConnectNetworks() *common.DataSource {

0 commit comments

Comments
 (0)