Skip to content

Commit b693f04

Browse files
authored
Fix bug in PDC data source (#1995)
* Filter to pdc access policies and fix struct issue * Fix broken link * Require client to not be nil * Revert "Require client to not be nil" This reverts commit b4f1b89.
1 parent 6918038 commit b693f04

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

docs/resources/machine_learning_job.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ page_title: "grafana_machine_learning_job Resource - terraform-provider-grafana"
44
subcategory: "Machine Learning"
55
description: |-
66
A job defines the queries and model parameters for a machine learning task.
7-
See the Grafana Cloud docs https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/forecasts/models/ for more information
7+
See the Grafana Cloud docs https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/dynamic-alerting/forecasting/config/ for more information
88
on available hyperparameters for use in the hyper_params field.
99
---
1010

1111
# grafana_machine_learning_job (Resource)
1212

1313
A job defines the queries and model parameters for a machine learning task.
1414

15-
See [the Grafana Cloud docs](https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/forecasts/models/) for more information
15+
See [the Grafana Cloud docs](https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/dynamic-alerting/forecasting/config/) for more information
1616
on available hyperparameters for use in the `hyper_params` field.
1717

1818
## Example Usage

internal/resources/cloud/data_source_private_data_source_connect_network.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cloud
22

33
import (
44
"context"
5+
"slices"
56

67
"github.com/grafana/terraform-provider-grafana/v3/internal/common"
78
"github.com/hashicorp/terraform-plugin-framework/attr"
@@ -81,7 +82,7 @@ type PDCNetworksDataSourceModel struct {
8182
ID types.String `tfsdk:"id"`
8283
NameFilter types.String `tfsdk:"name_filter"`
8384
RegionFilter types.String `tfsdk:"region_filter"`
84-
PrivateDataSourceNetworks []PDCNetworksDataSourcePolicyModel `tfsdk:"private_data_source_networks"`
85+
PrivateDataSourceNetworks []PDCNetworksDataSourcePolicyModel `tfsdk:"private_data_source_connect_networks"`
8586
}
8687

8788
func (r *PDCNetworksDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
@@ -114,6 +115,9 @@ func (r *PDCNetworksDataSource) Read(ctx context.Context, req datasource.ReadReq
114115
if data.NameFilter.ValueString() != "" && data.NameFilter.ValueString() != policy.Name {
115116
continue
116117
}
118+
if !slices.Contains(policy.Scopes, "pdc-signing:write") {
119+
continue
120+
}
117121
data.PrivateDataSourceNetworks = append(data.PrivateDataSourceNetworks, PDCNetworksDataSourcePolicyModel{
118122
ID: types.StringValue(*policy.Id),
119123
Region: types.StringValue(region),

internal/resources/machinelearning/resource_job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func resourceJob() *common.Resource {
1919
Description: `
2020
A job defines the queries and model parameters for a machine learning task.
2121
22-
See [the Grafana Cloud docs](https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/forecasts/models/) for more information
22+
See [the Grafana Cloud docs](https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/dynamic-alerting/forecasting/config/) for more information
2323
on available hyperparameters for use in the ` + "`hyper_params`" + ` field.`,
2424

2525
CreateContext: checkClient(resourceJobCreate),

0 commit comments

Comments
 (0)