From ebf6a2460e00ff2bb98dce902332b9f08d4c6255 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Thu, 4 Dec 2025 11:01:44 +0100 Subject: [PATCH 1/7] feat(cockpit): add support for cockpit actions --- ...tion_reset_grafana_user_password_action.go | 172 ++++++++++++++++++ ...reset_grafana_user_password_action_test.go | 107 +++++++++++ ...action_sync_grafana_data_sources_action.go | 107 +++++++++++ ...n_sync_grafana_data_sources_action_test.go | 123 +++++++++++++ .../action_trigger_test_alert_action.go | 122 +++++++++++++ .../action_trigger_test_alert_action_test.go | 103 +++++++++++ provider/framework.go | 2 + ...reset_grafana_user_password_action.md.tmpl | 10 + ...t_sync_grafana_data_sources_action.md.tmpl | 10 + .../cockpit_trigger_test_alert_action.md.tmpl | 10 + 10 files changed, 766 insertions(+) create mode 100644 internal/services/cockpit/action_reset_grafana_user_password_action.go create mode 100644 internal/services/cockpit/action_reset_grafana_user_password_action_test.go create mode 100644 internal/services/cockpit/action_sync_grafana_data_sources_action.go create mode 100644 internal/services/cockpit/action_sync_grafana_data_sources_action_test.go create mode 100644 internal/services/cockpit/action_trigger_test_alert_action.go create mode 100644 internal/services/cockpit/action_trigger_test_alert_action_test.go create mode 100644 templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl create mode 100644 templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl create mode 100644 templates/actions/cockpit_trigger_test_alert_action.md.tmpl diff --git a/internal/services/cockpit/action_reset_grafana_user_password_action.go b/internal/services/cockpit/action_reset_grafana_user_password_action.go new file mode 100644 index 0000000000..830dc8969d --- /dev/null +++ b/internal/services/cockpit/action_reset_grafana_user_password_action.go @@ -0,0 +1,172 @@ +package cockpit + +import ( + "context" + "fmt" + "strconv" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/action" + "github.com/hashicorp/terraform-plugin-framework/action/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" +) + +var ( + _ action.Action = (*ResetGrafanaUserPasswordAction)(nil) + _ action.ActionWithConfigure = (*ResetGrafanaUserPasswordAction)(nil) +) + +type ResetGrafanaUserPasswordAction struct { + globalAPI *cockpit.GlobalAPI +} + +func (a *ResetGrafanaUserPasswordAction) Configure(ctx context.Context, req action.ConfigureRequest, resp *action.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + m, ok := req.ProviderData.(*meta.Meta) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Action Configure Type", + fmt.Sprintf("Expected *meta.Meta, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + client := m.ScwClient() + a.globalAPI = cockpit.NewGlobalAPI(client) +} + +func (a *ResetGrafanaUserPasswordAction) Metadata(ctx context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_cockpit_reset_grafana_user_password_action" +} + +type ResetGrafanaUserPasswordActionModel struct { + GrafanaUserID types.String `tfsdk:"grafana_user_id"` + ProjectID types.String `tfsdk:"project_id"` +} + +func NewResetGrafanaUserPasswordAction() action.Action { + return &ResetGrafanaUserPasswordAction{} +} + +func (a *ResetGrafanaUserPasswordAction) Schema(ctx context.Context, req action.SchemaRequest, resp *action.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "grafana_user_id": schema.StringAttribute{ + Required: true, + Description: "ID of the Grafana user", + }, + "project_id": schema.StringAttribute{ + Optional: true, + Description: "ID of the Project. If not provided, will be extracted from grafana_user_id if it's in format 'project_id/user_id'", + }, + }, + } +} + +func (a *ResetGrafanaUserPasswordAction) Invoke(ctx context.Context, req action.InvokeRequest, resp *action.InvokeResponse) { + var data ResetGrafanaUserPasswordActionModel + + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if a.globalAPI == nil { + resp.Diagnostics.AddError( + "Unconfigured globalAPI", + "The action was not properly configured. The Scaleway client is missing. "+ + "This is usually a bug in the provider. Please report it to the maintainers.", + ) + + return + } + + grafanaUserIDStr := data.GrafanaUserID.ValueString() + if grafanaUserIDStr == "" { + resp.Diagnostics.AddError( + "Missing grafana_user_id", + "The grafana_user_id attribute is required to reset Grafana user password.", + ) + + return + } + + // Parse ID format: project_id/grafana_user_id or just grafana_user_id + var grafanaUserID uint32 + projectID := data.ProjectID.ValueString() + + if strings.Contains(grafanaUserIDStr, "/") { + // ID format: project_id/grafana_user_id + parsedProjectID, grafanaUserIDPart, err := parseCockpitID(grafanaUserIDStr) + if err != nil { + resp.Diagnostics.AddError( + "Invalid grafana_user_id format", + fmt.Sprintf("The grafana_user_id must be in format 'project_id/user_id' or just 'user_id': %s", err), + ) + + return + } + + // Use parsed project_id if project_id was not explicitly provided + if projectID == "" { + projectID = parsedProjectID + } + + grafanaUserIDUint, err := strconv.ParseUint(grafanaUserIDPart, 10, 32) + if err != nil { + resp.Diagnostics.AddError( + "Invalid grafana_user_id", + fmt.Sprintf("The grafana_user_id must be a valid uint32: %s", err), + ) + + return + } + + grafanaUserID = uint32(grafanaUserIDUint) + } else { + // Just grafana_user_id (uint32 as string) + if projectID == "" { + resp.Diagnostics.AddError( + "Missing project_id", + "The project_id attribute is required when grafana_user_id is not in format 'project_id/user_id'.", + ) + + return + } + + grafanaUserIDUint, err := strconv.ParseUint(grafanaUserIDStr, 10, 32) + if err != nil { + resp.Diagnostics.AddError( + "Invalid grafana_user_id", + fmt.Sprintf("The grafana_user_id must be a valid uint32: %s", err), + ) + + return + } + + grafanaUserID = uint32(grafanaUserIDUint) + } + + _, err := a.globalAPI.ResetGrafanaUserPassword(&cockpit.GlobalAPIResetGrafanaUserPasswordRequest{ + GrafanaUserID: grafanaUserID, + ProjectID: projectID, + }, scw.WithContext(ctx)) + + if err != nil { + resp.Diagnostics.AddError( + "Error executing Cockpit ResetGrafanaUserPassword action", + fmt.Sprintf("Failed to reset password for Grafana user %s: %s", data.GrafanaUserID.ValueString(), err), + ) + + return + } +} + diff --git a/internal/services/cockpit/action_reset_grafana_user_password_action_test.go b/internal/services/cockpit/action_reset_grafana_user_password_action_test.go new file mode 100644 index 0000000000..4816eb9287 --- /dev/null +++ b/internal/services/cockpit/action_reset_grafana_user_password_action_test.go @@ -0,0 +1,107 @@ +package cockpit_test + +import ( + "errors" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" +) + +func TestAccActionCockpitResetGrafanaUserPassword_Basic(t *testing.T) { + if acctest.IsRunningOpenTofu() { + t.Skip("Skipping TestAccActionCockpitResetGrafanaUserPassword_Basic because actions are not yet supported on OpenTofu") + } + + tt := acctest.NewTestTools(t) + defer tt.Cleanup() + + resource.ParallelTest(t, resource.TestCase{ + ProtoV6ProviderFactories: tt.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: ` + resource "scaleway_account_project" "project" { + name = "tf_tests_cockpit_reset_password" + } + + resource "scaleway_cockpit_grafana_user" "main" { + project_id = scaleway_account_project.project.id + login = "test-user" + role = "viewer" + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_cockpit_reset_grafana_user_password_action.main] + } + } + } + + action "scaleway_cockpit_reset_grafana_user_password_action" "main" { + config { + grafana_user_id = scaleway_cockpit_grafana_user.main.id + project_id = scaleway_account_project.project.id + } + } + `, + }, + { + Config: ` + resource "scaleway_account_project" "project" { + name = "tf_tests_cockpit_reset_password" + } + + resource "scaleway_cockpit_grafana_user" "main" { + project_id = scaleway_account_project.project.id + login = "test-user" + role = "viewer" + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_cockpit_reset_grafana_user_password_action.main] + } + } + } + + action "scaleway_cockpit_reset_grafana_user_password_action" "main" { + config { + grafana_user_id = scaleway_cockpit_grafana_user.main.id + project_id = scaleway_account_project.project.id + } + } + + data "scaleway_audit_trail_event" "cockpit" { + project_id = scaleway_account_project.project.id + method_name = "ResetGrafanaUserPassword" + } + `, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.scaleway_audit_trail_event.cockpit", "events.#"), + func(state *terraform.State) error { + rs, ok := state.RootModule().Resources["data.scaleway_audit_trail_event.cockpit"] + if !ok { + return errors.New("not found: data.scaleway_audit_trail_event.cockpit") + } + + for key, value := range rs.Primary.Attributes { + if !strings.Contains(key, "method_name") { + continue + } + + if value == "ResetGrafanaUserPassword" { + return nil + } + } + + return errors.New("did not find the ResetGrafanaUserPassword event") + }, + ), + }, + }, + }) +} + diff --git a/internal/services/cockpit/action_sync_grafana_data_sources_action.go b/internal/services/cockpit/action_sync_grafana_data_sources_action.go new file mode 100644 index 0000000000..d54956ba63 --- /dev/null +++ b/internal/services/cockpit/action_sync_grafana_data_sources_action.go @@ -0,0 +1,107 @@ +package cockpit + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-framework/action" + "github.com/hashicorp/terraform-plugin-framework/action/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" +) + +var ( + _ action.Action = (*SyncGrafanaDataSourcesAction)(nil) + _ action.ActionWithConfigure = (*SyncGrafanaDataSourcesAction)(nil) +) + +type SyncGrafanaDataSourcesAction struct { + globalAPI *cockpit.GlobalAPI +} + +func (a *SyncGrafanaDataSourcesAction) Configure(ctx context.Context, req action.ConfigureRequest, resp *action.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + m, ok := req.ProviderData.(*meta.Meta) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Action Configure Type", + fmt.Sprintf("Expected *meta.Meta, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + client := m.ScwClient() + a.globalAPI = cockpit.NewGlobalAPI(client) +} + +func (a *SyncGrafanaDataSourcesAction) Metadata(ctx context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_cockpit_sync_grafana_data_sources_action" +} + +type SyncGrafanaDataSourcesActionModel struct { + ProjectID types.String `tfsdk:"project_id"` +} + +func NewSyncGrafanaDataSourcesAction() action.Action { + return &SyncGrafanaDataSourcesAction{} +} + +func (a *SyncGrafanaDataSourcesAction) Schema(ctx context.Context, req action.SchemaRequest, resp *action.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "project_id": schema.StringAttribute{ + Required: true, + Description: "ID of the Project", + }, + }, + } +} + +func (a *SyncGrafanaDataSourcesAction) Invoke(ctx context.Context, req action.InvokeRequest, resp *action.InvokeResponse) { + var data SyncGrafanaDataSourcesActionModel + + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if a.globalAPI == nil { + resp.Diagnostics.AddError( + "Unconfigured globalAPI", + "The action was not properly configured. The Scaleway client is missing. "+ + "This is usually a bug in the provider. Please report it to the maintainers.", + ) + + return + } + + if data.ProjectID.IsNull() || data.ProjectID.ValueString() == "" { + resp.Diagnostics.AddError( + "Missing project_id", + "The project_id attribute is required to sync Grafana data sources.", + ) + + return + } + + err := a.globalAPI.SyncGrafanaDataSources(&cockpit.GlobalAPISyncGrafanaDataSourcesRequest{ + ProjectID: data.ProjectID.ValueString(), + }, scw.WithContext(ctx)) + + if err != nil { + resp.Diagnostics.AddError( + "Error executing Cockpit SyncGrafanaDataSources action", + fmt.Sprintf("Failed to sync Grafana data sources for project %s: %s", data.ProjectID.ValueString(), err), + ) + + return + } +} + diff --git a/internal/services/cockpit/action_sync_grafana_data_sources_action_test.go b/internal/services/cockpit/action_sync_grafana_data_sources_action_test.go new file mode 100644 index 0000000000..8a73eec55a --- /dev/null +++ b/internal/services/cockpit/action_sync_grafana_data_sources_action_test.go @@ -0,0 +1,123 @@ +package cockpit_test + +import ( + "errors" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" +) + +func TestAccActionCockpitSyncGrafanaDataSources_Basic(t *testing.T) { + if acctest.IsRunningOpenTofu() { + t.Skip("Skipping TestAccActionCockpitSyncGrafanaDataSources_Basic because actions are not yet supported on OpenTofu") + } + + tt := acctest.NewTestTools(t) + defer tt.Cleanup() + + resource.ParallelTest(t, resource.TestCase{ + ProtoV6ProviderFactories: tt.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: ` + resource "scaleway_account_project" "project" { + name = "tf_tests_cockpit_sync_data_sources" + } + + resource "scaleway_cockpit_grafana_user" "main" { + project_id = scaleway_account_project.project.id + login = "test-sync-user" + role = "viewer" + } + + resource "scaleway_cockpit_source" "metrics" { + project_id = scaleway_account_project.project.id + name = "test-metrics-source" + type = "metrics" + retention_days = 31 + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_cockpit_sync_grafana_data_sources_action.main] + } + } + + depends_on = [scaleway_cockpit_grafana_user.main] + } + + action "scaleway_cockpit_sync_grafana_data_sources_action" "main" { + config { + project_id = scaleway_account_project.project.id + } + } + `, + }, + { + Config: ` + resource "scaleway_account_project" "project" { + name = "tf_tests_cockpit_sync_data_sources" + } + + resource "scaleway_cockpit_grafana_user" "main" { + project_id = scaleway_account_project.project.id + login = "test-sync-user" + role = "viewer" + } + + resource "scaleway_cockpit_source" "metrics" { + project_id = scaleway_account_project.project.id + name = "test-metrics-source" + type = "metrics" + retention_days = 31 + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_cockpit_sync_grafana_data_sources_action.main] + } + } + + depends_on = [scaleway_cockpit_grafana_user.main] + } + + action "scaleway_cockpit_sync_grafana_data_sources_action" "main" { + config { + project_id = scaleway_account_project.project.id + } + } + + data "scaleway_audit_trail_event" "cockpit" { + project_id = scaleway_account_project.project.id + method_name = "SyncGrafanaDataSources" + } + `, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.scaleway_audit_trail_event.cockpit", "events.#"), + func(state *terraform.State) error { + rs, ok := state.RootModule().Resources["data.scaleway_audit_trail_event.cockpit"] + if !ok { + return errors.New("not found: data.scaleway_audit_trail_event.cockpit") + } + + for key, value := range rs.Primary.Attributes { + if !strings.Contains(key, "method_name") { + continue + } + + if value == "SyncGrafanaDataSources" { + return nil + } + } + + return errors.New("did not find the SyncGrafanaDataSources event") + }, + ), + }, + }, + }) +} + diff --git a/internal/services/cockpit/action_trigger_test_alert_action.go b/internal/services/cockpit/action_trigger_test_alert_action.go new file mode 100644 index 0000000000..d7954fcdff --- /dev/null +++ b/internal/services/cockpit/action_trigger_test_alert_action.go @@ -0,0 +1,122 @@ +package cockpit + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-framework/action" + "github.com/hashicorp/terraform-plugin-framework/action/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" +) + +var ( + _ action.Action = (*TriggerTestAlertAction)(nil) + _ action.ActionWithConfigure = (*TriggerTestAlertAction)(nil) +) + +type TriggerTestAlertAction struct { + regionalAPI *cockpit.RegionalAPI +} + +func (a *TriggerTestAlertAction) Configure(ctx context.Context, req action.ConfigureRequest, resp *action.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + m, ok := req.ProviderData.(*meta.Meta) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Action Configure Type", + fmt.Sprintf("Expected *meta.Meta, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + client := m.ScwClient() + a.regionalAPI = cockpit.NewRegionalAPI(client) +} + +func (a *TriggerTestAlertAction) Metadata(ctx context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_cockpit_trigger_test_alert_action" +} + +type TriggerTestAlertActionModel struct { + ProjectID types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` +} + +func NewTriggerTestAlertAction() action.Action { + return &TriggerTestAlertAction{} +} + +func (a *TriggerTestAlertAction) Schema(ctx context.Context, req action.SchemaRequest, resp *action.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "project_id": schema.StringAttribute{ + Required: true, + Description: "ID of the Project", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "Region to target", + }, + }, + } +} + +func (a *TriggerTestAlertAction) Invoke(ctx context.Context, req action.InvokeRequest, resp *action.InvokeResponse) { + var data TriggerTestAlertActionModel + + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if a.regionalAPI == nil { + resp.Diagnostics.AddError( + "Unconfigured regionalAPI", + "The action was not properly configured. The Scaleway client is missing. "+ + "This is usually a bug in the provider. Please report it to the maintainers.", + ) + + return + } + + if data.ProjectID.IsNull() || data.ProjectID.ValueString() == "" { + resp.Diagnostics.AddError( + "Missing project_id", + "The project_id attribute is required to trigger a test alert.", + ) + + return + } + + if data.Region.IsNull() || data.Region.ValueString() == "" { + resp.Diagnostics.AddError( + "Missing region", + "The region attribute is required to trigger a test alert.", + ) + + return + } + + err := a.regionalAPI.TriggerTestAlert(&cockpit.RegionalAPITriggerTestAlertRequest{ + ProjectID: data.ProjectID.ValueString(), + Region: scw.Region(data.Region.ValueString()), + }, scw.WithContext(ctx)) + + if err != nil { + resp.Diagnostics.AddError( + "Error executing Cockpit TriggerTestAlert action", + fmt.Sprintf("Failed to trigger test alert for project %s: %s", data.ProjectID.ValueString(), err), + ) + + return + } +} + diff --git a/internal/services/cockpit/action_trigger_test_alert_action_test.go b/internal/services/cockpit/action_trigger_test_alert_action_test.go new file mode 100644 index 0000000000..41a97024f4 --- /dev/null +++ b/internal/services/cockpit/action_trigger_test_alert_action_test.go @@ -0,0 +1,103 @@ +package cockpit_test + +import ( + "errors" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" +) + +func TestAccActionCockpitTriggerTestAlert_Basic(t *testing.T) { + if acctest.IsRunningOpenTofu() { + t.Skip("Skipping TestAccActionCockpitTriggerTestAlert_Basic because actions are not yet supported on OpenTofu") + } + + tt := acctest.NewTestTools(t) + defer tt.Cleanup() + + resource.ParallelTest(t, resource.TestCase{ + ProtoV6ProviderFactories: tt.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: ` + resource "scaleway_account_project" "project" { + name = "tf_tests_cockpit_trigger_test_alert" + } + + resource "scaleway_cockpit_alert_manager" "main" { + project_id = scaleway_account_project.project.id + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_cockpit_trigger_test_alert_action.main] + } + } + } + + action "scaleway_cockpit_trigger_test_alert_action" "main" { + config { + project_id = scaleway_account_project.project.id + region = scaleway_cockpit_alert_manager.main.region + } + } + `, + }, + { + Config: ` + resource "scaleway_account_project" "project" { + name = "tf_tests_cockpit_trigger_test_alert" + } + + resource "scaleway_cockpit_alert_manager" "main" { + project_id = scaleway_account_project.project.id + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_cockpit_trigger_test_alert_action.main] + } + } + } + + action "scaleway_cockpit_trigger_test_alert_action" "main" { + config { + project_id = scaleway_account_project.project.id + region = scaleway_cockpit_alert_manager.main.region + } + } + + data "scaleway_audit_trail_event" "cockpit" { + project_id = scaleway_account_project.project.id + method_name = "TriggerTestAlert" + } + `, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.scaleway_audit_trail_event.cockpit", "events.#"), + func(state *terraform.State) error { + rs, ok := state.RootModule().Resources["data.scaleway_audit_trail_event.cockpit"] + if !ok { + return errors.New("not found: data.scaleway_audit_trail_event.cockpit") + } + + for key, value := range rs.Primary.Attributes { + if !strings.Contains(key, "method_name") { + continue + } + + if value == "TriggerTestAlert" { + return nil + } + } + + return errors.New("did not find the TriggerTestAlert event") + }, + ), + }, + }, + }) +} + diff --git a/provider/framework.go b/provider/framework.go index b35c784344..6c6ea73a31 100644 --- a/provider/framework.go +++ b/provider/framework.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/cockpit" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/instance" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/jobs" ) @@ -139,6 +140,7 @@ func (p *ScalewayProvider) Actions(_ context.Context) []func() action.Action { var res []func() action.Action res = append(res, instance.NewServerAction) + res = append(res, cockpit.NewTriggerTestAlertAction) res = append(res, jobs.NewStartJobDefinitionAction) return res diff --git a/templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl b/templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl new file mode 100644 index 0000000000..80248aab76 --- /dev/null +++ b/templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl @@ -0,0 +1,10 @@ +{{- /*gotype: github.com/hashicorp/terraform-plugin-docs/internal/provider.ActionTemplateType */ -}} +--- +subcategory: "Cockpit" +page_title: "Scaleway: scaleway_cockpit_reset_grafana_user_password_action" +--- + +# scaleway_cockpit_reset_grafana_user_password_action (Action) + +{{ .SchemaMarkdown }} + diff --git a/templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl b/templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl new file mode 100644 index 0000000000..7a143f0fcf --- /dev/null +++ b/templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl @@ -0,0 +1,10 @@ +{{- /*gotype: github.com/hashicorp/terraform-plugin-docs/internal/provider.ActionTemplateType */ -}} +--- +subcategory: "Cockpit" +page_title: "Scaleway: scaleway_cockpit_sync_grafana_data_sources_action" +--- + +# scaleway_cockpit_sync_grafana_data_sources_action (Action) + +{{ .SchemaMarkdown }} + diff --git a/templates/actions/cockpit_trigger_test_alert_action.md.tmpl b/templates/actions/cockpit_trigger_test_alert_action.md.tmpl new file mode 100644 index 0000000000..afdc0a2667 --- /dev/null +++ b/templates/actions/cockpit_trigger_test_alert_action.md.tmpl @@ -0,0 +1,10 @@ +{{- /*gotype: github.com/hashicorp/terraform-plugin-docs/internal/provider.ActionTemplateType */ -}} +--- +subcategory: "Cockpit" +page_title: "Scaleway: scaleway_cockpit_trigger_test_alert_action" +--- + +# scaleway_cockpit_trigger_test_alert_action (Action) + +{{ .SchemaMarkdown }} + From 89ef472b88c382c83b80580ed5bb2181e238b7b7 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Thu, 4 Dec 2025 11:38:53 +0100 Subject: [PATCH 2/7] feat: add Cockpit TriggerTestAlert action and remove deprecated Grafana actions --- ...tion_reset_grafana_user_password_action.go | 172 ------------------ ...reset_grafana_user_password_action_test.go | 107 ----------- ...action_sync_grafana_data_sources_action.go | 107 ----------- ...n_sync_grafana_data_sources_action_test.go | 123 ------------- .../action_trigger_test_alert_action.go | 32 ++-- .../action_trigger_test_alert_action_test.go | 21 ++- ...reset_grafana_user_password_action.md.tmpl | 10 - ...t_sync_grafana_data_sources_action.md.tmpl | 10 - 8 files changed, 39 insertions(+), 543 deletions(-) delete mode 100644 internal/services/cockpit/action_reset_grafana_user_password_action.go delete mode 100644 internal/services/cockpit/action_reset_grafana_user_password_action_test.go delete mode 100644 internal/services/cockpit/action_sync_grafana_data_sources_action.go delete mode 100644 internal/services/cockpit/action_sync_grafana_data_sources_action_test.go delete mode 100644 templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl delete mode 100644 templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl diff --git a/internal/services/cockpit/action_reset_grafana_user_password_action.go b/internal/services/cockpit/action_reset_grafana_user_password_action.go deleted file mode 100644 index 830dc8969d..0000000000 --- a/internal/services/cockpit/action_reset_grafana_user_password_action.go +++ /dev/null @@ -1,172 +0,0 @@ -package cockpit - -import ( - "context" - "fmt" - "strconv" - "strings" - - "github.com/hashicorp/terraform-plugin-framework/action" - "github.com/hashicorp/terraform-plugin-framework/action/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1" - "github.com/scaleway/scaleway-sdk-go/scw" - "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" -) - -var ( - _ action.Action = (*ResetGrafanaUserPasswordAction)(nil) - _ action.ActionWithConfigure = (*ResetGrafanaUserPasswordAction)(nil) -) - -type ResetGrafanaUserPasswordAction struct { - globalAPI *cockpit.GlobalAPI -} - -func (a *ResetGrafanaUserPasswordAction) Configure(ctx context.Context, req action.ConfigureRequest, resp *action.ConfigureResponse) { - if req.ProviderData == nil { - return - } - - m, ok := req.ProviderData.(*meta.Meta) - if !ok { - resp.Diagnostics.AddError( - "Unexpected Action Configure Type", - fmt.Sprintf("Expected *meta.Meta, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - client := m.ScwClient() - a.globalAPI = cockpit.NewGlobalAPI(client) -} - -func (a *ResetGrafanaUserPasswordAction) Metadata(ctx context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_cockpit_reset_grafana_user_password_action" -} - -type ResetGrafanaUserPasswordActionModel struct { - GrafanaUserID types.String `tfsdk:"grafana_user_id"` - ProjectID types.String `tfsdk:"project_id"` -} - -func NewResetGrafanaUserPasswordAction() action.Action { - return &ResetGrafanaUserPasswordAction{} -} - -func (a *ResetGrafanaUserPasswordAction) Schema(ctx context.Context, req action.SchemaRequest, resp *action.SchemaResponse) { - resp.Schema = schema.Schema{ - Attributes: map[string]schema.Attribute{ - "grafana_user_id": schema.StringAttribute{ - Required: true, - Description: "ID of the Grafana user", - }, - "project_id": schema.StringAttribute{ - Optional: true, - Description: "ID of the Project. If not provided, will be extracted from grafana_user_id if it's in format 'project_id/user_id'", - }, - }, - } -} - -func (a *ResetGrafanaUserPasswordAction) Invoke(ctx context.Context, req action.InvokeRequest, resp *action.InvokeResponse) { - var data ResetGrafanaUserPasswordActionModel - - resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - - if resp.Diagnostics.HasError() { - return - } - - if a.globalAPI == nil { - resp.Diagnostics.AddError( - "Unconfigured globalAPI", - "The action was not properly configured. The Scaleway client is missing. "+ - "This is usually a bug in the provider. Please report it to the maintainers.", - ) - - return - } - - grafanaUserIDStr := data.GrafanaUserID.ValueString() - if grafanaUserIDStr == "" { - resp.Diagnostics.AddError( - "Missing grafana_user_id", - "The grafana_user_id attribute is required to reset Grafana user password.", - ) - - return - } - - // Parse ID format: project_id/grafana_user_id or just grafana_user_id - var grafanaUserID uint32 - projectID := data.ProjectID.ValueString() - - if strings.Contains(grafanaUserIDStr, "/") { - // ID format: project_id/grafana_user_id - parsedProjectID, grafanaUserIDPart, err := parseCockpitID(grafanaUserIDStr) - if err != nil { - resp.Diagnostics.AddError( - "Invalid grafana_user_id format", - fmt.Sprintf("The grafana_user_id must be in format 'project_id/user_id' or just 'user_id': %s", err), - ) - - return - } - - // Use parsed project_id if project_id was not explicitly provided - if projectID == "" { - projectID = parsedProjectID - } - - grafanaUserIDUint, err := strconv.ParseUint(grafanaUserIDPart, 10, 32) - if err != nil { - resp.Diagnostics.AddError( - "Invalid grafana_user_id", - fmt.Sprintf("The grafana_user_id must be a valid uint32: %s", err), - ) - - return - } - - grafanaUserID = uint32(grafanaUserIDUint) - } else { - // Just grafana_user_id (uint32 as string) - if projectID == "" { - resp.Diagnostics.AddError( - "Missing project_id", - "The project_id attribute is required when grafana_user_id is not in format 'project_id/user_id'.", - ) - - return - } - - grafanaUserIDUint, err := strconv.ParseUint(grafanaUserIDStr, 10, 32) - if err != nil { - resp.Diagnostics.AddError( - "Invalid grafana_user_id", - fmt.Sprintf("The grafana_user_id must be a valid uint32: %s", err), - ) - - return - } - - grafanaUserID = uint32(grafanaUserIDUint) - } - - _, err := a.globalAPI.ResetGrafanaUserPassword(&cockpit.GlobalAPIResetGrafanaUserPasswordRequest{ - GrafanaUserID: grafanaUserID, - ProjectID: projectID, - }, scw.WithContext(ctx)) - - if err != nil { - resp.Diagnostics.AddError( - "Error executing Cockpit ResetGrafanaUserPassword action", - fmt.Sprintf("Failed to reset password for Grafana user %s: %s", data.GrafanaUserID.ValueString(), err), - ) - - return - } -} - diff --git a/internal/services/cockpit/action_reset_grafana_user_password_action_test.go b/internal/services/cockpit/action_reset_grafana_user_password_action_test.go deleted file mode 100644 index 4816eb9287..0000000000 --- a/internal/services/cockpit/action_reset_grafana_user_password_action_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package cockpit_test - -import ( - "errors" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" -) - -func TestAccActionCockpitResetGrafanaUserPassword_Basic(t *testing.T) { - if acctest.IsRunningOpenTofu() { - t.Skip("Skipping TestAccActionCockpitResetGrafanaUserPassword_Basic because actions are not yet supported on OpenTofu") - } - - tt := acctest.NewTestTools(t) - defer tt.Cleanup() - - resource.ParallelTest(t, resource.TestCase{ - ProtoV6ProviderFactories: tt.ProviderFactories, - Steps: []resource.TestStep{ - { - Config: ` - resource "scaleway_account_project" "project" { - name = "tf_tests_cockpit_reset_password" - } - - resource "scaleway_cockpit_grafana_user" "main" { - project_id = scaleway_account_project.project.id - login = "test-user" - role = "viewer" - - lifecycle { - action_trigger { - events = [after_create] - actions = [action.scaleway_cockpit_reset_grafana_user_password_action.main] - } - } - } - - action "scaleway_cockpit_reset_grafana_user_password_action" "main" { - config { - grafana_user_id = scaleway_cockpit_grafana_user.main.id - project_id = scaleway_account_project.project.id - } - } - `, - }, - { - Config: ` - resource "scaleway_account_project" "project" { - name = "tf_tests_cockpit_reset_password" - } - - resource "scaleway_cockpit_grafana_user" "main" { - project_id = scaleway_account_project.project.id - login = "test-user" - role = "viewer" - - lifecycle { - action_trigger { - events = [after_create] - actions = [action.scaleway_cockpit_reset_grafana_user_password_action.main] - } - } - } - - action "scaleway_cockpit_reset_grafana_user_password_action" "main" { - config { - grafana_user_id = scaleway_cockpit_grafana_user.main.id - project_id = scaleway_account_project.project.id - } - } - - data "scaleway_audit_trail_event" "cockpit" { - project_id = scaleway_account_project.project.id - method_name = "ResetGrafanaUserPassword" - } - `, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.scaleway_audit_trail_event.cockpit", "events.#"), - func(state *terraform.State) error { - rs, ok := state.RootModule().Resources["data.scaleway_audit_trail_event.cockpit"] - if !ok { - return errors.New("not found: data.scaleway_audit_trail_event.cockpit") - } - - for key, value := range rs.Primary.Attributes { - if !strings.Contains(key, "method_name") { - continue - } - - if value == "ResetGrafanaUserPassword" { - return nil - } - } - - return errors.New("did not find the ResetGrafanaUserPassword event") - }, - ), - }, - }, - }) -} - diff --git a/internal/services/cockpit/action_sync_grafana_data_sources_action.go b/internal/services/cockpit/action_sync_grafana_data_sources_action.go deleted file mode 100644 index d54956ba63..0000000000 --- a/internal/services/cockpit/action_sync_grafana_data_sources_action.go +++ /dev/null @@ -1,107 +0,0 @@ -package cockpit - -import ( - "context" - "fmt" - - "github.com/hashicorp/terraform-plugin-framework/action" - "github.com/hashicorp/terraform-plugin-framework/action/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1" - "github.com/scaleway/scaleway-sdk-go/scw" - "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" -) - -var ( - _ action.Action = (*SyncGrafanaDataSourcesAction)(nil) - _ action.ActionWithConfigure = (*SyncGrafanaDataSourcesAction)(nil) -) - -type SyncGrafanaDataSourcesAction struct { - globalAPI *cockpit.GlobalAPI -} - -func (a *SyncGrafanaDataSourcesAction) Configure(ctx context.Context, req action.ConfigureRequest, resp *action.ConfigureResponse) { - if req.ProviderData == nil { - return - } - - m, ok := req.ProviderData.(*meta.Meta) - if !ok { - resp.Diagnostics.AddError( - "Unexpected Action Configure Type", - fmt.Sprintf("Expected *meta.Meta, got: %T. Please report this issue to the provider developers.", req.ProviderData), - ) - - return - } - - client := m.ScwClient() - a.globalAPI = cockpit.NewGlobalAPI(client) -} - -func (a *SyncGrafanaDataSourcesAction) Metadata(ctx context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_cockpit_sync_grafana_data_sources_action" -} - -type SyncGrafanaDataSourcesActionModel struct { - ProjectID types.String `tfsdk:"project_id"` -} - -func NewSyncGrafanaDataSourcesAction() action.Action { - return &SyncGrafanaDataSourcesAction{} -} - -func (a *SyncGrafanaDataSourcesAction) Schema(ctx context.Context, req action.SchemaRequest, resp *action.SchemaResponse) { - resp.Schema = schema.Schema{ - Attributes: map[string]schema.Attribute{ - "project_id": schema.StringAttribute{ - Required: true, - Description: "ID of the Project", - }, - }, - } -} - -func (a *SyncGrafanaDataSourcesAction) Invoke(ctx context.Context, req action.InvokeRequest, resp *action.InvokeResponse) { - var data SyncGrafanaDataSourcesActionModel - - resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - - if resp.Diagnostics.HasError() { - return - } - - if a.globalAPI == nil { - resp.Diagnostics.AddError( - "Unconfigured globalAPI", - "The action was not properly configured. The Scaleway client is missing. "+ - "This is usually a bug in the provider. Please report it to the maintainers.", - ) - - return - } - - if data.ProjectID.IsNull() || data.ProjectID.ValueString() == "" { - resp.Diagnostics.AddError( - "Missing project_id", - "The project_id attribute is required to sync Grafana data sources.", - ) - - return - } - - err := a.globalAPI.SyncGrafanaDataSources(&cockpit.GlobalAPISyncGrafanaDataSourcesRequest{ - ProjectID: data.ProjectID.ValueString(), - }, scw.WithContext(ctx)) - - if err != nil { - resp.Diagnostics.AddError( - "Error executing Cockpit SyncGrafanaDataSources action", - fmt.Sprintf("Failed to sync Grafana data sources for project %s: %s", data.ProjectID.ValueString(), err), - ) - - return - } -} - diff --git a/internal/services/cockpit/action_sync_grafana_data_sources_action_test.go b/internal/services/cockpit/action_sync_grafana_data_sources_action_test.go deleted file mode 100644 index 8a73eec55a..0000000000 --- a/internal/services/cockpit/action_sync_grafana_data_sources_action_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package cockpit_test - -import ( - "errors" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" -) - -func TestAccActionCockpitSyncGrafanaDataSources_Basic(t *testing.T) { - if acctest.IsRunningOpenTofu() { - t.Skip("Skipping TestAccActionCockpitSyncGrafanaDataSources_Basic because actions are not yet supported on OpenTofu") - } - - tt := acctest.NewTestTools(t) - defer tt.Cleanup() - - resource.ParallelTest(t, resource.TestCase{ - ProtoV6ProviderFactories: tt.ProviderFactories, - Steps: []resource.TestStep{ - { - Config: ` - resource "scaleway_account_project" "project" { - name = "tf_tests_cockpit_sync_data_sources" - } - - resource "scaleway_cockpit_grafana_user" "main" { - project_id = scaleway_account_project.project.id - login = "test-sync-user" - role = "viewer" - } - - resource "scaleway_cockpit_source" "metrics" { - project_id = scaleway_account_project.project.id - name = "test-metrics-source" - type = "metrics" - retention_days = 31 - - lifecycle { - action_trigger { - events = [after_create] - actions = [action.scaleway_cockpit_sync_grafana_data_sources_action.main] - } - } - - depends_on = [scaleway_cockpit_grafana_user.main] - } - - action "scaleway_cockpit_sync_grafana_data_sources_action" "main" { - config { - project_id = scaleway_account_project.project.id - } - } - `, - }, - { - Config: ` - resource "scaleway_account_project" "project" { - name = "tf_tests_cockpit_sync_data_sources" - } - - resource "scaleway_cockpit_grafana_user" "main" { - project_id = scaleway_account_project.project.id - login = "test-sync-user" - role = "viewer" - } - - resource "scaleway_cockpit_source" "metrics" { - project_id = scaleway_account_project.project.id - name = "test-metrics-source" - type = "metrics" - retention_days = 31 - - lifecycle { - action_trigger { - events = [after_create] - actions = [action.scaleway_cockpit_sync_grafana_data_sources_action.main] - } - } - - depends_on = [scaleway_cockpit_grafana_user.main] - } - - action "scaleway_cockpit_sync_grafana_data_sources_action" "main" { - config { - project_id = scaleway_account_project.project.id - } - } - - data "scaleway_audit_trail_event" "cockpit" { - project_id = scaleway_account_project.project.id - method_name = "SyncGrafanaDataSources" - } - `, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.scaleway_audit_trail_event.cockpit", "events.#"), - func(state *terraform.State) error { - rs, ok := state.RootModule().Resources["data.scaleway_audit_trail_event.cockpit"] - if !ok { - return errors.New("not found: data.scaleway_audit_trail_event.cockpit") - } - - for key, value := range rs.Primary.Attributes { - if !strings.Contains(key, "method_name") { - continue - } - - if value == "SyncGrafanaDataSources" { - return nil - } - } - - return errors.New("did not find the SyncGrafanaDataSources event") - }, - ), - }, - }, - }) -} - diff --git a/internal/services/cockpit/action_trigger_test_alert_action.go b/internal/services/cockpit/action_trigger_test_alert_action.go index d7954fcdff..1e0340436c 100644 --- a/internal/services/cockpit/action_trigger_test_alert_action.go +++ b/internal/services/cockpit/action_trigger_test_alert_action.go @@ -19,6 +19,7 @@ var ( type TriggerTestAlertAction struct { regionalAPI *cockpit.RegionalAPI + meta *meta.Meta } func (a *TriggerTestAlertAction) Configure(ctx context.Context, req action.ConfigureRequest, resp *action.ConfigureResponse) { @@ -38,6 +39,7 @@ func (a *TriggerTestAlertAction) Configure(ctx context.Context, req action.Confi client := m.ScwClient() a.regionalAPI = cockpit.NewRegionalAPI(client) + a.meta = m } func (a *TriggerTestAlertAction) Metadata(ctx context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { @@ -61,8 +63,8 @@ func (a *TriggerTestAlertAction) Schema(ctx context.Context, req action.SchemaRe Description: "ID of the Project", }, "region": schema.StringAttribute{ - Required: true, - Description: "Region to target", + Optional: true, + Description: "Region to target. If not provided, will use the default region from the provider configuration", }, }, } @@ -96,18 +98,27 @@ func (a *TriggerTestAlertAction) Invoke(ctx context.Context, req action.InvokeRe return } - if data.Region.IsNull() || data.Region.ValueString() == "" { - resp.Diagnostics.AddError( - "Missing region", - "The region attribute is required to trigger a test alert.", - ) - - return + var region scw.Region + if !data.Region.IsNull() && data.Region.ValueString() != "" { + region = scw.Region(data.Region.ValueString()) + } else { + // Use default region from provider configuration + defaultRegion, exists := a.meta.ScwClient().GetDefaultRegion() + if !exists { + resp.Diagnostics.AddError( + "Missing region", + "The region attribute is required to trigger a test alert. Please provide it explicitly or configure a default region in the provider.", + ) + + return + } + + region = defaultRegion } err := a.regionalAPI.TriggerTestAlert(&cockpit.RegionalAPITriggerTestAlertRequest{ ProjectID: data.ProjectID.ValueString(), - Region: scw.Region(data.Region.ValueString()), + Region: region, }, scw.WithContext(ctx)) if err != nil { @@ -119,4 +130,3 @@ func (a *TriggerTestAlertAction) Invoke(ctx context.Context, req action.InvokeRe return } } - diff --git a/internal/services/cockpit/action_trigger_test_alert_action_test.go b/internal/services/cockpit/action_trigger_test_alert_action_test.go index 41a97024f4..19c40e51cf 100644 --- a/internal/services/cockpit/action_trigger_test_alert_action_test.go +++ b/internal/services/cockpit/action_trigger_test_alert_action_test.go @@ -29,6 +29,13 @@ func TestAccActionCockpitTriggerTestAlert_Basic(t *testing.T) { resource "scaleway_cockpit_alert_manager" "main" { project_id = scaleway_account_project.project.id + } + + resource "scaleway_cockpit_source" "metrics" { + project_id = scaleway_account_project.project.id + name = "test-metrics-source" + type = "metrics" + retention_days = 31 lifecycle { action_trigger { @@ -36,12 +43,13 @@ func TestAccActionCockpitTriggerTestAlert_Basic(t *testing.T) { actions = [action.scaleway_cockpit_trigger_test_alert_action.main] } } + + depends_on = [scaleway_cockpit_alert_manager.main] } action "scaleway_cockpit_trigger_test_alert_action" "main" { config { project_id = scaleway_account_project.project.id - region = scaleway_cockpit_alert_manager.main.region } } `, @@ -54,6 +62,13 @@ func TestAccActionCockpitTriggerTestAlert_Basic(t *testing.T) { resource "scaleway_cockpit_alert_manager" "main" { project_id = scaleway_account_project.project.id + } + + resource "scaleway_cockpit_source" "metrics" { + project_id = scaleway_account_project.project.id + name = "test-metrics-source" + type = "metrics" + retention_days = 31 lifecycle { action_trigger { @@ -61,12 +76,13 @@ func TestAccActionCockpitTriggerTestAlert_Basic(t *testing.T) { actions = [action.scaleway_cockpit_trigger_test_alert_action.main] } } + + depends_on = [scaleway_cockpit_alert_manager.main] } action "scaleway_cockpit_trigger_test_alert_action" "main" { config { project_id = scaleway_account_project.project.id - region = scaleway_cockpit_alert_manager.main.region } } @@ -100,4 +116,3 @@ func TestAccActionCockpitTriggerTestAlert_Basic(t *testing.T) { }, }) } - diff --git a/templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl b/templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl deleted file mode 100644 index 80248aab76..0000000000 --- a/templates/actions/cockpit_reset_grafana_user_password_action.md.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -{{- /*gotype: github.com/hashicorp/terraform-plugin-docs/internal/provider.ActionTemplateType */ -}} ---- -subcategory: "Cockpit" -page_title: "Scaleway: scaleway_cockpit_reset_grafana_user_password_action" ---- - -# scaleway_cockpit_reset_grafana_user_password_action (Action) - -{{ .SchemaMarkdown }} - diff --git a/templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl b/templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl deleted file mode 100644 index 7a143f0fcf..0000000000 --- a/templates/actions/cockpit_sync_grafana_data_sources_action.md.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -{{- /*gotype: github.com/hashicorp/terraform-plugin-docs/internal/provider.ActionTemplateType */ -}} ---- -subcategory: "Cockpit" -page_title: "Scaleway: scaleway_cockpit_sync_grafana_data_sources_action" ---- - -# scaleway_cockpit_sync_grafana_data_sources_action (Action) - -{{ .SchemaMarkdown }} - From 4f6907877c2f9efa89a8d3053d4692d254189221 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Thu, 4 Dec 2025 15:30:58 +0100 Subject: [PATCH 3/7] fix: add missing blank line and include cassette file --- ...pit-trigger-test-alert-basic.cassette.yaml | 1432 +++++++++++++++++ 1 file changed, 1432 insertions(+) create mode 100644 internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml diff --git a/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml b/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml new file mode 100644 index 0000000000..15176a5a9b --- /dev/null +++ b/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml @@ -0,0 +1,1432 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 120 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","description":""}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/account/v3/projects + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 277 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":null,"updated_at":"2025-12-04T10:35:05.165861Z"}' + headers: + Content-Length: + - "277" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:05 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - b7d2fd49-18e5-4550-8a70-bc1eb6cce319 + status: 200 OK + code: 200 + duration: 619.010667ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 322 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + headers: + Content-Length: + - "322" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:05 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 9ddc9d53-71b1-470f-9829-dcb8375141a3 + status: 200 OK + code: 200 + duration: 193.420917ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 53 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/enable + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 187 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":false,"region":"fr-par"}' + headers: + Content-Length: + - "187" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:07 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 03aab4d6-1ff1-49e3-8cc1-539c9c6d7674 + status: 200 OK + code: 200 + duration: 2.381425583s + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 53 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/managed-alerts/enable + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 186 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + headers: + Content-Length: + - "186" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:13 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 98bd7469-5b6c-412b-ab4e-0039f284583d + status: 200 OK + code: 200 + duration: 5.583824084s + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 186 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + headers: + Content-Length: + - "186" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:13 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - db5052a6-c56a-49c0-a7e6-f866a4fd30a8 + status: 200 OK + code: 200 + duration: 144.505458ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 111 + uncompressed: false + body: '{"contact_points":[],"has_additional_contact_points":false,"has_additional_receivers":false,"total_count":0}' + headers: + Content-Length: + - "111" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:13 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 2e0c6d96-2c29-49d3-b649-6911d875f9c3 + status: 200 OK + code: 200 + duration: 374.864834ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 53 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/trigger-test-alert + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:14 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 9e6d071e-675f-4d90-912a-400292d032c6 + status: 204 No Content + code: 204 + duration: 505.61525ms + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 119 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"test-metrics-source","type":"metrics","retention_days":31}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + headers: + Content-Length: + - "440" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:15 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - cd8f2ef8-2462-4b05-8701-a53467e636a9 + status: 200 OK + code: 200 + duration: 1.8173615s + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + headers: + Content-Length: + - "440" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:16 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - e2ddc2b1-5865-44e3-bbd0-6a6fe2beba60 + status: 200 OK + code: 200 + duration: 157.747166ms + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 322 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + headers: + Content-Length: + - "322" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:16 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - afbee251-078c-4d41-998d-9f33ebf3dd73 + status: 200 OK + code: 200 + duration: 186.376917ms + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 186 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + headers: + Content-Length: + - "186" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:16 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 0f866c73-1a39-4497-a9cf-9fce89918e9f + status: 200 OK + code: 200 + duration: 184.848917ms + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 111 + uncompressed: false + body: '{"contact_points":[],"has_additional_contact_points":false,"has_additional_receivers":false,"total_count":0}' + headers: + Content-Length: + - "111" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:16 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - a1919bd6-a840-435f-b0be-fac8f7c10056 + status: 200 OK + code: 200 + duration: 115.917708ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + headers: + Content-Length: + - "440" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:17 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 14db4675-2688-4418-b411-d29524a280f3 + status: 200 OK + code: 200 + duration: 120.3415ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 322 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + headers: + Content-Length: + - "322" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:17 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 81c8ccfe-1e68-4c2d-a90b-4188a31f6cde + status: 200 OK + code: 200 + duration: 139.760584ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 186 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + headers: + Content-Length: + - "186" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:17 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - c50c4c42-ebf0-4aa1-9c28-2a8b45527b2e + status: 200 OK + code: 200 + duration: 90.06125ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f&resource_type=unknown_type + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 13 + uncompressed: false + body: '{"events":[]}' + headers: + Content-Length: + - "13" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:17 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 911f22c6-2541-45ea-a1a4-c0ebcd9e0c69 + status: 200 OK + code: 200 + duration: 149.676792ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 111 + uncompressed: false + body: '{"contact_points":[],"has_additional_contact_points":false,"has_additional_receivers":false,"total_count":0}' + headers: + Content-Length: + - "111" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:17 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 557bdd65-f981-4aaa-8557-5c07cd1cb722 + status: 200 OK + code: 200 + duration: 199.349666ms + - id: 17 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + headers: + Content-Length: + - "440" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:17 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 205c5977-14e6-42a3-882f-4aef3d5b6628 + status: 200 OK + code: 200 + duration: 177.708791ms + - id: 18 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f&resource_type=unknown_type + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 13 + uncompressed: false + body: '{"events":[]}' + headers: + Content-Length: + - "13" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:18 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 06430796-2140-41a5-bc96-9ca3ac9d911e + status: 200 OK + code: 200 + duration: 155.491ms + - id: 19 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 322 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + headers: + Content-Length: + - "322" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:18 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - f02f2e81-52cd-4f65-8103-f6cbd914e389 + status: 200 OK + code: 200 + duration: 36.433917ms + - id: 20 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f&resource_type=unknown_type + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 13 + uncompressed: false + body: '{"events":[]}' + headers: + Content-Length: + - "13" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:18 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 0cbab283-47e4-43ee-ace7-92a7e3ca2d1f + status: 200 OK + code: 200 + duration: 55.939375ms + - id: 21 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 186 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + headers: + Content-Length: + - "186" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:18 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 9cf1d5af-dd35-4247-a6b0-9493b845bd43 + status: 200 OK + code: 200 + duration: 159.261875ms + - id: 22 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 111 + uncompressed: false + body: '{"contact_points":[],"has_additional_contact_points":false,"has_additional_receivers":false,"total_count":0}' + headers: + Content-Length: + - "111" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:18 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 11fe4087-2b3b-47fa-b002-9cb499b1320a + status: 200 OK + code: 200 + duration: 148.169125ms + - id: 23 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + headers: + Content-Length: + - "440" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:18 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - fc67a3e0-6260-40ca-91b3-af9b6666a111 + status: 200 OK + code: 200 + duration: 115.580375ms + - id: 24 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:19 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - e98147c3-6946-4c51-8f89-81646fbf9787 + status: 204 No Content + code: 204 + duration: 518.058583ms + - id: 25 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 111 + uncompressed: false + body: '{"contact_points":[],"has_additional_contact_points":false,"has_additional_receivers":false,"total_count":0}' + headers: + Content-Length: + - "111" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:19 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - adf71179-8ebe-4307-8d46-4b9968572af0 + status: 200 OK + code: 200 + duration: 155.201583ms + - id: 26 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 53 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/managed-alerts/disable + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 187 + uncompressed: false + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":false,"region":"fr-par"}' + headers: + Content-Length: + - "187" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:20 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 41a77134-1bef-48cd-9d3c-e3010948dc6a + status: 200 OK + code: 200 + duration: 653.007208ms + - id: 27 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 53 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/disable + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 108 + uncompressed: false + body: '{"alert_manager_enabled":false,"alert_manager_url":null,"managed_alerts_enabled":false,"region":"fr-par"}' + headers: + Content-Length: + - "108" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:20 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - e78d8ac6-e834-48da-a1a3-1af7339f7fd0 + status: 200 OK + code: 200 + duration: 237.149209ms + - id: 28 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 10:35:22 GMT + Server: + - Scaleway API Gateway (fr-par-2;edge02) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - a2c9b038-a22b-46aa-8ec1-0041736cff80 + status: 204 No Content + code: 204 + duration: 1.50274275s From aad59f1ebb6ea9adeff5e3a4664d357378542c85 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Fri, 5 Dec 2025 08:02:58 +0100 Subject: [PATCH 4/7] fix: correct gofumpt formatting issue --- internal/services/cockpit/action_trigger_test_alert_action.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/services/cockpit/action_trigger_test_alert_action.go b/internal/services/cockpit/action_trigger_test_alert_action.go index 1e0340436c..462097f515 100644 --- a/internal/services/cockpit/action_trigger_test_alert_action.go +++ b/internal/services/cockpit/action_trigger_test_alert_action.go @@ -120,7 +120,6 @@ func (a *TriggerTestAlertAction) Invoke(ctx context.Context, req action.InvokeRe ProjectID: data.ProjectID.ValueString(), Region: region, }, scw.WithContext(ctx)) - if err != nil { resp.Diagnostics.AddError( "Error executing Cockpit TriggerTestAlert action", From 7c2d22e01df2eab21d59c9a24efc13f871758c50 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Fri, 5 Dec 2025 10:43:53 +0100 Subject: [PATCH 5/7] feat: add regional schema helper for Plugin Framework actions --- .../locality/regional/schemas_framework.go | 29 +++++++++++++++++++ .../action_trigger_test_alert_action.go | 19 ++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 internal/locality/regional/schemas_framework.go diff --git a/internal/locality/regional/schemas_framework.go b/internal/locality/regional/schemas_framework.go new file mode 100644 index 0000000000..3525a95ae3 --- /dev/null +++ b/internal/locality/regional/schemas_framework.go @@ -0,0 +1,29 @@ +package regional + +import ( + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/action/schema" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +// AllRegions returns all valid Scaleway regions as strings +func AllRegions() []string { + regions := make([]string, 0, len(scw.AllRegions)) + for _, r := range scw.AllRegions { + regions = append(regions, r.String()) + } + + return regions +} + +// SchemaAttribute returns a Plugin Framework schema attribute for a region field +func SchemaAttribute() schema.StringAttribute { + return schema.StringAttribute{ + Optional: true, + Description: "The region you want to attach the resource to", + Validators: []validator.String{ + stringvalidator.OneOf(AllRegions()...), + }, + } +} diff --git a/internal/services/cockpit/action_trigger_test_alert_action.go b/internal/services/cockpit/action_trigger_test_alert_action.go index 462097f515..8100fd8432 100644 --- a/internal/services/cockpit/action_trigger_test_alert_action.go +++ b/internal/services/cockpit/action_trigger_test_alert_action.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1" "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional" "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" ) @@ -62,10 +63,7 @@ func (a *TriggerTestAlertAction) Schema(ctx context.Context, req action.SchemaRe Required: true, Description: "ID of the Project", }, - "region": schema.StringAttribute{ - Optional: true, - Description: "Region to target. If not provided, will use the default region from the provider configuration", - }, + "region": regional.SchemaAttribute(), }, } } @@ -99,8 +97,19 @@ func (a *TriggerTestAlertAction) Invoke(ctx context.Context, req action.InvokeRe } var region scw.Region + if !data.Region.IsNull() && data.Region.ValueString() != "" { - region = scw.Region(data.Region.ValueString()) + parsedRegion, err := scw.ParseRegion(data.Region.ValueString()) + if err != nil { + resp.Diagnostics.AddError( + "Invalid region", + fmt.Sprintf("The region attribute must be a valid Scaleway region. Got %q: %s", data.Region.ValueString(), err), + ) + + return + } + + region = parsedRegion } else { // Use default region from provider configuration defaultRegion, exists := a.meta.ScwClient().GetDefaultRegion() From 417444ee3f8dcccd7c34a24c55a0162a90882de1 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Fri, 5 Dec 2025 10:44:11 +0100 Subject: [PATCH 6/7] feat: compress cockpit trigger test alert action cassette --- ...pit-trigger-test-alert-basic.cassette.yaml | 332 +++++++++--------- 1 file changed, 166 insertions(+), 166 deletions(-) diff --git a/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml b/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml index 15176a5a9b..aaefa31d94 100644 --- a/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml +++ b/internal/services/cockpit/testdata/action-cockpit-trigger-test-alert-basic.cassette.yaml @@ -29,7 +29,7 @@ interactions: trailer: {} content_length: 277 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":null,"updated_at":"2025-12-04T10:35:05.165861Z"}' + body: '{"created_at":"2025-12-05T09:31:19.599344Z","description":"","id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":null,"updated_at":"2025-12-05T09:31:19.599344Z"}' headers: Content-Length: - "277" @@ -38,9 +38,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:05 GMT + - Fri, 05 Dec 2025 09:31:19 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -48,10 +48,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - b7d2fd49-18e5-4550-8a70-bc1eb6cce319 + - c07554af-7847-45f8-b58d-210dfe403b48 status: 200 OK code: 200 - duration: 619.010667ms + duration: 567.061042ms - id: 1 request: proto: HTTP/1.1 @@ -68,7 +68,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/account/v3/projects/d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -78,7 +78,7 @@ interactions: trailer: {} content_length: 322 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + body: '{"created_at":"2025-12-05T09:31:19.599344Z","description":"","id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-05T09:31:19.599344Z"}' headers: Content-Length: - "322" @@ -87,9 +87,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:05 GMT + - Fri, 05 Dec 2025 09:31:20 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -97,10 +97,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 9ddc9d53-71b1-470f-9829-dcb8375141a3 + - e876af7e-a1e6-4ddf-813d-177bfa2fe89e status: 200 OK code: 200 - duration: 193.420917ms + duration: 190.346708ms - id: 2 request: proto: HTTP/1.1 @@ -112,7 +112,7 @@ interactions: host: api.scaleway.com remote_addr: "" request_uri: "" - body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + body: '{"project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0"}' form: {} headers: Content-Type: @@ -129,7 +129,7 @@ interactions: trailer: {} content_length: 187 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":false,"region":"fr-par"}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":false,"region":"fr-par"}' headers: Content-Length: - "187" @@ -138,9 +138,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:07 GMT + - Fri, 05 Dec 2025 09:31:20 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -148,10 +148,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 03aab4d6-1ff1-49e3-8cc1-539c9c6d7674 + - 5ca13682-7581-4e42-a105-329df89d932c status: 200 OK code: 200 - duration: 2.381425583s + duration: 340.521417ms - id: 3 request: proto: HTTP/1.1 @@ -163,7 +163,7 @@ interactions: host: api.scaleway.com remote_addr: "" request_uri: "" - body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + body: '{"project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0"}' form: {} headers: Content-Type: @@ -180,7 +180,7 @@ interactions: trailer: {} content_length: 186 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' headers: Content-Length: - "186" @@ -189,9 +189,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:13 GMT + - Fri, 05 Dec 2025 09:31:23 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -199,10 +199,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 98bd7469-5b6c-412b-ab4e-0039f284583d + - 413783f7-1207-43c5-b2b0-32ce1e5f3ee1 status: 200 OK code: 200 - duration: 5.583824084s + duration: 2.747412041s - id: 4 request: proto: HTTP/1.1 @@ -219,7 +219,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -229,7 +229,7 @@ interactions: trailer: {} content_length: 186 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' headers: Content-Length: - "186" @@ -238,9 +238,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:13 GMT + - Fri, 05 Dec 2025 09:31:23 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -248,10 +248,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - db5052a6-c56a-49c0-a7e6-f866a4fd30a8 + - 1673e3d1-d56d-4948-80d3-2766dd39ab46 status: 200 OK code: 200 - duration: 144.505458ms + duration: 118.537875ms - id: 5 request: proto: HTTP/1.1 @@ -268,7 +268,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -287,9 +287,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:13 GMT + - Fri, 05 Dec 2025 09:31:23 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -297,10 +297,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 2e0c6d96-2c29-49d3-b649-6911d875f9c3 + - 585a7dbf-a016-472d-8ea3-72cf646da9f3 status: 200 OK code: 200 - duration: 374.864834ms + duration: 142.14275ms - id: 6 request: proto: HTTP/1.1 @@ -312,7 +312,7 @@ interactions: host: api.scaleway.com remote_addr: "" request_uri: "" - body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + body: '{"project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0"}' form: {} headers: Content-Type: @@ -336,9 +336,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:14 GMT + - Fri, 05 Dec 2025 09:31:23 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -346,10 +346,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 9e6d071e-675f-4d90-912a-400292d032c6 + - 77688625-5dc1-49c2-9aca-655577ae63bd status: 204 No Content code: 204 - duration: 505.61525ms + duration: 257.615083ms - id: 7 request: proto: HTTP/1.1 @@ -361,7 +361,7 @@ interactions: host: api.scaleway.com remote_addr: "" request_uri: "" - body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"test-metrics-source","type":"metrics","retention_days":31}' + body: '{"project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","name":"test-metrics-source","type":"metrics","retention_days":31}' form: {} headers: Content-Type: @@ -378,7 +378,7 @@ interactions: trailer: {} content_length: 440 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + body: '{"created_at":"2025-12-05T09:31:23.668391Z","current_month_usage":0,"id":"c9a4784f-b0bd-444e-880c-aa1c60f1896a","name":"test-metrics-source","origin":"custom","project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-05T09:31:23.668391Z","url":"https://c9a4784f-b0bd-444e-880c-aa1c60f1896a.metrics.cockpit.fr-par.scw.cloud"}' headers: Content-Length: - "440" @@ -387,9 +387,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:15 GMT + - Fri, 05 Dec 2025 09:31:23 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -397,10 +397,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - cd8f2ef8-2462-4b05-8701-a53467e636a9 + - 7b5a5926-1b9f-43f2-b8ce-11aff37ab67d status: 200 OK code: 200 - duration: 1.8173615s + duration: 366.24875ms - id: 8 request: proto: HTTP/1.1 @@ -417,7 +417,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/c9a4784f-b0bd-444e-880c-aa1c60f1896a method: GET response: proto: HTTP/2.0 @@ -427,7 +427,7 @@ interactions: trailer: {} content_length: 440 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + body: '{"created_at":"2025-12-05T09:31:23.668391Z","current_month_usage":0,"id":"c9a4784f-b0bd-444e-880c-aa1c60f1896a","name":"test-metrics-source","origin":"custom","project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-05T09:31:23.668391Z","url":"https://c9a4784f-b0bd-444e-880c-aa1c60f1896a.metrics.cockpit.fr-par.scw.cloud"}' headers: Content-Length: - "440" @@ -436,9 +436,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:16 GMT + - Fri, 05 Dec 2025 09:31:23 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -446,10 +446,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - e2ddc2b1-5865-44e3-bbd0-6a6fe2beba60 + - 9745aac4-cf7b-498e-b47d-e545e1b2be5c status: 200 OK code: 200 - duration: 157.747166ms + duration: 128.98975ms - id: 9 request: proto: HTTP/1.1 @@ -466,7 +466,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/account/v3/projects/d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -476,7 +476,7 @@ interactions: trailer: {} content_length: 322 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + body: '{"created_at":"2025-12-05T09:31:19.599344Z","description":"","id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-05T09:31:19.599344Z"}' headers: Content-Length: - "322" @@ -485,9 +485,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:16 GMT + - Fri, 05 Dec 2025 09:31:24 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -495,10 +495,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - afbee251-078c-4d41-998d-9f33ebf3dd73 + - 3b00deb6-53d1-403f-84d5-3158673e555f status: 200 OK code: 200 - duration: 186.376917ms + duration: 231.023625ms - id: 10 request: proto: HTTP/1.1 @@ -515,7 +515,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -525,7 +525,7 @@ interactions: trailer: {} content_length: 186 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' headers: Content-Length: - "186" @@ -534,9 +534,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:16 GMT + - Fri, 05 Dec 2025 09:31:24 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -544,10 +544,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 0f866c73-1a39-4497-a9cf-9fce89918e9f + - 3eb74b0b-f13f-4d91-a73f-dc50f495420b status: 200 OK code: 200 - duration: 184.848917ms + duration: 105.819834ms - id: 11 request: proto: HTTP/1.1 @@ -564,7 +564,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -583,9 +583,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:16 GMT + - Fri, 05 Dec 2025 09:31:24 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -593,10 +593,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - a1919bd6-a840-435f-b0be-fac8f7c10056 + - 0d4c3343-6f2c-4b48-83a0-646a63b59f81 status: 200 OK code: 200 - duration: 115.917708ms + duration: 144.468166ms - id: 12 request: proto: HTTP/1.1 @@ -613,7 +613,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/c9a4784f-b0bd-444e-880c-aa1c60f1896a method: GET response: proto: HTTP/2.0 @@ -623,7 +623,7 @@ interactions: trailer: {} content_length: 440 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + body: '{"created_at":"2025-12-05T09:31:23.668391Z","current_month_usage":0,"id":"c9a4784f-b0bd-444e-880c-aa1c60f1896a","name":"test-metrics-source","origin":"custom","project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-05T09:31:23.668391Z","url":"https://c9a4784f-b0bd-444e-880c-aa1c60f1896a.metrics.cockpit.fr-par.scw.cloud"}' headers: Content-Length: - "440" @@ -632,9 +632,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:17 GMT + - Fri, 05 Dec 2025 09:31:24 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -642,10 +642,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 14db4675-2688-4418-b411-d29524a280f3 + - 677efe82-7099-4aa3-b1d6-b2113eb375b7 status: 200 OK code: 200 - duration: 120.3415ms + duration: 39.170792ms - id: 13 request: proto: HTTP/1.1 @@ -662,7 +662,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/account/v3/projects/d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -672,7 +672,7 @@ interactions: trailer: {} content_length: 322 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + body: '{"created_at":"2025-12-05T09:31:19.599344Z","description":"","id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-05T09:31:19.599344Z"}' headers: Content-Length: - "322" @@ -681,9 +681,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:17 GMT + - Fri, 05 Dec 2025 09:31:25 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -691,10 +691,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 81c8ccfe-1e68-4c2d-a90b-4188a31f6cde + - e58a5e46-d27b-458f-86bc-61995b299e74 status: 200 OK code: 200 - duration: 139.760584ms + duration: 219.520542ms - id: 14 request: proto: HTTP/1.1 @@ -711,7 +711,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -721,7 +721,7 @@ interactions: trailer: {} content_length: 186 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' headers: Content-Length: - "186" @@ -730,9 +730,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:17 GMT + - Fri, 05 Dec 2025 09:31:25 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -740,10 +740,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - c50c4c42-ebf0-4aa1-9c28-2a8b45527b2e + - 5b1503ac-e1b6-45f4-ba98-0279ee8fe381 status: 200 OK code: 200 - duration: 90.06125ms + duration: 117.078292ms - id: 15 request: proto: HTTP/1.1 @@ -760,7 +760,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f&resource_type=unknown_type + url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0&resource_type=unknown_type method: GET response: proto: HTTP/2.0 @@ -779,9 +779,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:17 GMT + - Fri, 05 Dec 2025 09:31:25 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -789,10 +789,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 911f22c6-2541-45ea-a1a4-c0ebcd9e0c69 + - cdf810c4-b1d8-4662-9a64-137091e4a106 status: 200 OK code: 200 - duration: 149.676792ms + duration: 151.133416ms - id: 16 request: proto: HTTP/1.1 @@ -809,7 +809,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -828,9 +828,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:17 GMT + - Fri, 05 Dec 2025 09:31:25 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -838,10 +838,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 557bdd65-f981-4aaa-8557-5c07cd1cb722 + - 4d8789e4-99d5-4f6c-aade-7b316f8da21b status: 200 OK code: 200 - duration: 199.349666ms + duration: 64.49ms - id: 17 request: proto: HTTP/1.1 @@ -858,7 +858,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/c9a4784f-b0bd-444e-880c-aa1c60f1896a method: GET response: proto: HTTP/2.0 @@ -868,7 +868,7 @@ interactions: trailer: {} content_length: 440 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + body: '{"created_at":"2025-12-05T09:31:23.668391Z","current_month_usage":0,"id":"c9a4784f-b0bd-444e-880c-aa1c60f1896a","name":"test-metrics-source","origin":"custom","project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-05T09:31:23.668391Z","url":"https://c9a4784f-b0bd-444e-880c-aa1c60f1896a.metrics.cockpit.fr-par.scw.cloud"}' headers: Content-Length: - "440" @@ -877,9 +877,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:17 GMT + - Fri, 05 Dec 2025 09:31:25 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -887,10 +887,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 205c5977-14e6-42a3-882f-4aef3d5b6628 + - 7a385fa1-862e-4b38-b5a0-dcaa8b6d468a status: 200 OK code: 200 - duration: 177.708791ms + duration: 141.390584ms - id: 18 request: proto: HTTP/1.1 @@ -907,7 +907,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f&resource_type=unknown_type + url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0&resource_type=unknown_type method: GET response: proto: HTTP/2.0 @@ -926,9 +926,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:18 GMT + - Fri, 05 Dec 2025 09:31:25 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -936,10 +936,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 06430796-2140-41a5-bc96-9ca3ac9d911e + - 726025de-d439-44c8-81d5-101429545c16 status: 200 OK code: 200 - duration: 155.491ms + duration: 39.558ms - id: 19 request: proto: HTTP/1.1 @@ -956,7 +956,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/account/v3/projects/d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -966,7 +966,7 @@ interactions: trailer: {} content_length: 322 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:05.165861Z","description":"","id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-04T10:35:05.165861Z"}' + body: '{"created_at":"2025-12-05T09:31:19.599344Z","description":"","id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","name":"tf_tests_cockpit_trigger_test_alert","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-12-05T09:31:19.599344Z"}' headers: Content-Length: - "322" @@ -975,9 +975,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:18 GMT + - Fri, 05 Dec 2025 09:31:26 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -985,10 +985,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - f02f2e81-52cd-4f65-8103-f6cbd914e389 + - 865a55db-a7a6-4b43-8736-e4cf7c52f4cd status: 200 OK code: 200 - duration: 36.433917ms + duration: 56.021833ms - id: 20 request: proto: HTTP/1.1 @@ -1005,7 +1005,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f&resource_type=unknown_type + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -1013,20 +1013,20 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 13 + content_length: 186 uncompressed: false - body: '{"events":[]}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' headers: Content-Length: - - "13" + - "186" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:18 GMT + - Fri, 05 Dec 2025 09:31:26 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1034,10 +1034,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 0cbab283-47e4-43ee-ace7-92a7e3ca2d1f + - f0df9a33-ccc7-468b-9d28-37d99e1d9e2c status: 200 OK code: 200 - duration: 55.939375ms + duration: 43.468792ms - id: 21 request: proto: HTTP/1.1 @@ -1054,7 +1054,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/audit-trail/v1alpha1/regions/fr-par/events?method_name=TriggerTestAlert&order_by=recorded_at_desc&organization_id=105bdce1-64c0-48ab-899d-868455867ecf&project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0&resource_type=unknown_type method: GET response: proto: HTTP/2.0 @@ -1062,20 +1062,20 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 186 + content_length: 13 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":true,"region":"fr-par"}' + body: '{"events":[]}' headers: Content-Length: - - "186" + - "13" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:18 GMT + - Fri, 05 Dec 2025 09:31:26 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1083,10 +1083,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 9cf1d5af-dd35-4247-a6b0-9493b845bd43 + - e6c69264-5324-4510-ad19-3e4955086c2a status: 200 OK code: 200 - duration: 159.261875ms + duration: 102.697541ms - id: 22 request: proto: HTTP/1.1 @@ -1103,7 +1103,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -1122,9 +1122,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:18 GMT + - Fri, 05 Dec 2025 09:31:26 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1132,10 +1132,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 11fe4087-2b3b-47fa-b002-9cb499b1320a + - 7e6f7c22-8d17-4645-b2b3-67722d709c53 status: 200 OK code: 200 - duration: 148.169125ms + duration: 92.839125ms - id: 23 request: proto: HTTP/1.1 @@ -1152,7 +1152,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/c9a4784f-b0bd-444e-880c-aa1c60f1896a method: GET response: proto: HTTP/2.0 @@ -1162,7 +1162,7 @@ interactions: trailer: {} content_length: 440 uncompressed: false - body: '{"created_at":"2025-12-04T10:35:14.345642Z","current_month_usage":0,"id":"34ecfc1f-7f09-44ed-8a81-b2e8b7362d51","name":"test-metrics-source","origin":"custom","project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-04T10:35:14.345642Z","url":"https://34ecfc1f-7f09-44ed-8a81-b2e8b7362d51.metrics.cockpit.fr-par.scw.cloud"}' + body: '{"created_at":"2025-12-05T09:31:23.668391Z","current_month_usage":0,"id":"c9a4784f-b0bd-444e-880c-aa1c60f1896a","name":"test-metrics-source","origin":"custom","project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0","region":"fr-par","retention_days":31,"synchronized_with_grafana":false,"type":"metrics","updated_at":"2025-12-05T09:31:23.668391Z","url":"https://c9a4784f-b0bd-444e-880c-aa1c60f1896a.metrics.cockpit.fr-par.scw.cloud"}' headers: Content-Length: - "440" @@ -1171,9 +1171,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:18 GMT + - Fri, 05 Dec 2025 09:31:26 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1181,10 +1181,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - fc67a3e0-6260-40ca-91b3-af9b6666a111 + - beec59c4-271a-4224-99db-3bb67cff3c7a status: 200 OK code: 200 - duration: 115.580375ms + duration: 118.315958ms - id: 24 request: proto: HTTP/1.1 @@ -1201,7 +1201,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/34ecfc1f-7f09-44ed-8a81-b2e8b7362d51 + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources/c9a4784f-b0bd-444e-880c-aa1c60f1896a method: DELETE response: proto: HTTP/2.0 @@ -1218,9 +1218,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:19 GMT + - Fri, 05 Dec 2025 09:31:27 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1228,10 +1228,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - e98147c3-6946-4c51-8f89-81646fbf9787 + - 02345058-a4e1-40cf-ba9c-fcd57dc4c3f9 status: 204 No Content code: 204 - duration: 518.058583ms + duration: 499.549458ms - id: 25 request: proto: HTTP/1.1 @@ -1248,7 +1248,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/cockpit/v1/regions/fr-par/alert-manager/contact-points?project_id=d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: GET response: proto: HTTP/2.0 @@ -1267,9 +1267,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:19 GMT + - Fri, 05 Dec 2025 09:31:27 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1277,10 +1277,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - adf71179-8ebe-4307-8d46-4b9968572af0 + - b5c95985-8f86-4e7d-bb3c-e973a9c56436 status: 200 OK code: 200 - duration: 155.201583ms + duration: 144.958917ms - id: 26 request: proto: HTTP/1.1 @@ -1292,7 +1292,7 @@ interactions: host: api.scaleway.com remote_addr: "" request_uri: "" - body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + body: '{"project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0"}' form: {} headers: Content-Type: @@ -1309,7 +1309,7 @@ interactions: trailer: {} content_length: 187 uncompressed: false - body: '{"alert_manager_enabled":true,"alert_manager_url":"https://ec441678-19ef-42f0-bd97-9d88deb6163e.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":false,"region":"fr-par"}' + body: '{"alert_manager_enabled":true,"alert_manager_url":"https://7a84b20e-0d34-45bf-8956-61406583a3cd.alertmanager.cockpit.fr-par.scw.cloud","managed_alerts_enabled":false,"region":"fr-par"}' headers: Content-Length: - "187" @@ -1318,9 +1318,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:20 GMT + - Fri, 05 Dec 2025 09:31:27 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1328,10 +1328,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 41a77134-1bef-48cd-9d3c-e3010948dc6a + - c1e3e961-8179-4146-8497-5c3aa41a8f28 status: 200 OK code: 200 - duration: 653.007208ms + duration: 353.87775ms - id: 27 request: proto: HTTP/1.1 @@ -1343,7 +1343,7 @@ interactions: host: api.scaleway.com remote_addr: "" request_uri: "" - body: '{"project_id":"49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f"}' + body: '{"project_id":"d39dc79c-0882-4f2a-ac07-b436f74f3ec0"}' form: {} headers: Content-Type: @@ -1369,9 +1369,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:20 GMT + - Fri, 05 Dec 2025 09:31:27 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1379,10 +1379,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - e78d8ac6-e834-48da-a1a3-1af7339f7fd0 + - e793e891-6610-422d-b910-26b3c498d900 status: 200 OK code: 200 - duration: 237.149209ms + duration: 239.674708ms - id: 28 request: proto: HTTP/1.1 @@ -1399,7 +1399,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.3; darwin; amd64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/account/v3/projects/49f9c8e5-2fd9-41d1-a8e5-80214eb1b84f + url: https://api.scaleway.com/account/v3/projects/d39dc79c-0882-4f2a-ac07-b436f74f3ec0 method: DELETE response: proto: HTTP/2.0 @@ -1416,9 +1416,9 @@ interactions: Content-Type: - application/json Date: - - Thu, 04 Dec 2025 10:35:22 GMT + - Fri, 05 Dec 2025 09:31:29 GMT Server: - - Scaleway API Gateway (fr-par-2;edge02) + - Scaleway API Gateway (fr-par-1;edge03) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -1426,7 +1426,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - a2c9b038-a22b-46aa-8ec1-0041736cff80 + - 7a7583e4-e37a-4868-9cc2-497db91f9a86 status: 204 No Content code: 204 - duration: 1.50274275s + duration: 1.507085667s From 838622e506e2ced9800708b8818e5e6788e0a4d3 Mon Sep 17 00:00:00 2001 From: Jonathan Remy Date: Wed, 10 Dec 2025 14:47:54 +0100 Subject: [PATCH 7/7] Remove strict region validator to allow new regions --- internal/locality/regional/schemas_framework.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/locality/regional/schemas_framework.go b/internal/locality/regional/schemas_framework.go index 3525a95ae3..4b287758bc 100644 --- a/internal/locality/regional/schemas_framework.go +++ b/internal/locality/regional/schemas_framework.go @@ -1,9 +1,7 @@ package regional import ( - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/action/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -22,8 +20,5 @@ func SchemaAttribute() schema.StringAttribute { return schema.StringAttribute{ Optional: true, Description: "The region you want to attach the resource to", - Validators: []validator.String{ - stringvalidator.OneOf(AllRegions()...), - }, } }