Skip to content

fix(cockpit): ignore deprecated field plan #2841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/resources/cockpit.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ page_title: "Scaleway: scaleway_cockpit"
As of September 2024, Cockpit has introduced [regionalization](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#region) to offer more flexibility and resilience.
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).

-> **Note:**
Cockpit plans scheduled for deprecation on January 1st 2025.
The retention period previously set for your logs and metrics will remain the same after that date.
You will be able to edit the retention period for your metrics, logs, and traces for free during Beta.

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.

The `scaleway_cockpit` resource allows you to create and manage Scaleway Cockpit instances.
Expand Down
11 changes: 5 additions & 6 deletions internal/services/cockpit/cockpit.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func ResourceCockpitCreate(ctx context.Context, d *schema.ResourceData, m interf
if targetPlanI, ok := d.GetOk("plan"); ok {
targetPlan := targetPlanI.(string)

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

_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{ //nolint:staticcheck
ProjectID: projectID,
PlanName: cockpit.PlanName(planName),
}, scw.WithContext(ctx))
Expand Down Expand Up @@ -150,8 +150,7 @@ func ResourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interfac
return diag.FromErr(err)
}
}

res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{ //nolint:staticcheck
ProjectID: projectID,
}, scw.WithContext(ctx))
if err != nil {
Expand Down Expand Up @@ -214,7 +213,7 @@ func ResourceCockpitUpdate(ctx context.Context, d *schema.ResourceData, m interf
targetPlan = targetPlanI.(string)
}

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

_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{ //nolint:staticcheck
ProjectID: projectID,
PlanName: cockpit.PlanName(planName),
}, scw.WithContext(ctx))
Expand Down
2 changes: 1 addition & 1 deletion internal/services/cockpit/cockpit_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func dataSourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interf
}
}

res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{ //nolint:staticcheck
ProjectID: projectID,
}, scw.WithContext(ctx))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/cockpit/plan_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func DataSourceCockpitPlanRead(ctx context.Context, d *schema.ResourceData, m in

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

res, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages())
res, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages()) //nolint:staticcheck
if err != nil {
return diag.FromErr(err)
}
Expand Down
Loading