Skip to content

Commit 36a1f88

Browse files
authored
fix(cockpit): ignore deprecated field plan (#2841)
1 parent 3d9d4ff commit 36a1f88

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

docs/resources/cockpit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ page_title: "Scaleway: scaleway_cockpit"
99
As of September 2024, Cockpit has introduced [regionalization](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#region) to offer more flexibility and resilience.
1010
If you have created customized dashboards with data for your Scaleway resources before April 2024, you will need to update your queries in Grafana, with the new regionalized [data sources](../resources/cockpit_source.md).
1111

12+
-> **Note:**
13+
Cockpit plans scheduled for deprecation on January 1st 2025.
14+
The retention period previously set for your logs and metrics will remain the same after that date.
15+
You will be able to edit the retention period for your metrics, logs, and traces for free during Beta.
16+
1217
Please note that even if you provide the grafana_url, it will only be active if a [Grafana user](../resources/cockpit_grafana_user.md) is created first. Make sure to create a Grafana user in your Cockpit instance to enable full access to Grafana.
1318

1419
The `scaleway_cockpit` resource allows you to create and manage Scaleway Cockpit instances.

internal/services/cockpit/cockpit.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func ResourceCockpitCreate(ctx context.Context, d *schema.ResourceData, m interf
103103
if targetPlanI, ok := d.GetOk("plan"); ok {
104104
targetPlan := targetPlanI.(string)
105105

106-
plans, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages())
106+
plans, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages()) //nolint:staticcheck
107107
if err != nil {
108108
return diag.FromErr(err)
109109
}
@@ -120,7 +120,7 @@ func ResourceCockpitCreate(ctx context.Context, d *schema.ResourceData, m interf
120120
return diag.Errorf("plan %s not found", targetPlan)
121121
}
122122

123-
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{
123+
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{ //nolint:staticcheck
124124
ProjectID: projectID,
125125
PlanName: cockpit.PlanName(planName),
126126
}, scw.WithContext(ctx))
@@ -150,8 +150,7 @@ func ResourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interfac
150150
return diag.FromErr(err)
151151
}
152152
}
153-
154-
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{
153+
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{ //nolint:staticcheck
155154
ProjectID: projectID,
156155
}, scw.WithContext(ctx))
157156
if err != nil {
@@ -214,7 +213,7 @@ func ResourceCockpitUpdate(ctx context.Context, d *schema.ResourceData, m interf
214213
targetPlan = targetPlanI.(string)
215214
}
216215

217-
plans, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages())
216+
plans, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages()) //nolint:staticcheck
218217
if err != nil {
219218
return diag.FromErr(err)
220219
}
@@ -231,7 +230,7 @@ func ResourceCockpitUpdate(ctx context.Context, d *schema.ResourceData, m interf
231230
return diag.Errorf("plan %s not found", targetPlan)
232231
}
233232

234-
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{
233+
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{ //nolint:staticcheck
235234
ProjectID: projectID,
236235
PlanName: cockpit.PlanName(planName),
237236
}, scw.WithContext(ctx))

internal/services/cockpit/cockpit_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func dataSourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interf
5353
}
5454
}
5555

56-
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{
56+
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{ //nolint:staticcheck
5757
ProjectID: projectID,
5858
}, scw.WithContext(ctx))
5959
if err != nil {

internal/services/cockpit/plan_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func DataSourceCockpitPlanRead(ctx context.Context, d *schema.ResourceData, m in
3131

3232
name := d.Get("name").(string)
3333

34-
res, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages())
34+
res, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages()) //nolint:staticcheck
3535
if err != nil {
3636
return diag.FromErr(err)
3737
}

0 commit comments

Comments
 (0)