diff --git a/docs/actions/mongodb_instance_snapshot_action.md b/docs/actions/mongodb_instance_snapshot_action.md new file mode 100644 index 0000000000..6f60fe78b5 --- /dev/null +++ b/docs/actions/mongodb_instance_snapshot_action.md @@ -0,0 +1,22 @@ +--- +subcategory: "MongoDB" +page_title: "Scaleway: scaleway_mongodb_instance_snapshot_action" +--- + +# scaleway_mongodb_instance_snapshot_action (Action) + + +## Schema + +### Required + +- `instance_id` (String) MongoDB instance ID to snapshot. Can be a plain UUID or a regional ID. + +### Optional + +- `expires_at` (String) Expiration date of the snapshot in RFC3339 format (ISO 8601). If not set, the snapshot will not expire. +- `name` (String) Name of the snapshot. If not set, a name will be generated. +- `region` (String) Region of the MongoDB instance. If not set, the region is derived from the instance_id when possible or from the provider configuration. +- `wait` (Boolean) Wait for the snapshot to reach a terminal state before returning. + + diff --git a/internal/services/mongodb/action_instance_snapshot_action.go b/internal/services/mongodb/action_instance_snapshot_action.go new file mode 100644 index 0000000000..613028e8e8 --- /dev/null +++ b/internal/services/mongodb/action_instance_snapshot_action.go @@ -0,0 +1,208 @@ +package mongodb + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/action" + "github.com/hashicorp/terraform-plugin-framework/action/schema" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + mongodb "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/meta" +) + +var ( + _ action.Action = (*InstanceSnapshotAction)(nil) + _ action.ActionWithConfigure = (*InstanceSnapshotAction)(nil) +) + +// InstanceSnapshotAction creates a snapshot for a MongoDB instance. +type InstanceSnapshotAction struct { + mongodbAPI *mongodb.API +} + +func (a *InstanceSnapshotAction) Configure(_ 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 + } + + a.mongodbAPI = newAPI(m) +} + +func (a *InstanceSnapshotAction) Metadata(_ context.Context, req action.MetadataRequest, resp *action.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_mongodb_instance_snapshot_action" +} + +type InstanceSnapshotActionModel struct { + InstanceID types.String `tfsdk:"instance_id"` + Region types.String `tfsdk:"region"` + Name types.String `tfsdk:"name"` + ExpiresAt types.String `tfsdk:"expires_at"` + Wait types.Bool `tfsdk:"wait"` +} + +// NewInstanceSnapshotAction returns a new MongoDB instance snapshot action. +func NewInstanceSnapshotAction() action.Action { + return &InstanceSnapshotAction{} +} + +func (a *InstanceSnapshotAction) Schema(_ context.Context, _ action.SchemaRequest, resp *action.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "instance_id": schema.StringAttribute{ + Required: true, + Description: "MongoDB instance ID to snapshot. Can be a plain UUID or a regional ID.", + Validators: []validator.String{ + stringvalidator.LengthAtLeast(1), + }, + }, + "region": schema.StringAttribute{ + Optional: true, + Description: "Region of the MongoDB instance. If not set, the region is derived from the instance_id when possible or from the provider configuration.", + }, + "name": schema.StringAttribute{ + Optional: true, + Description: "Name of the snapshot. If not set, a name will be generated.", + }, + "expires_at": schema.StringAttribute{ + Optional: true, + Description: "Expiration date of the snapshot in RFC3339 format (ISO 8601). If not set, the snapshot will not expire.", + }, + "wait": schema.BoolAttribute{ + Optional: true, + Description: "Wait for the snapshot to reach a terminal state before returning.", + }, + }, + } +} + +func (a *InstanceSnapshotAction) Invoke(ctx context.Context, req action.InvokeRequest, resp *action.InvokeResponse) { + var data InstanceSnapshotActionModel + + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if a.mongodbAPI == nil { + resp.Diagnostics.AddError( + "Unconfigured mongodbAPI", + "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.InstanceID.IsNull() || data.InstanceID.ValueString() == "" { + resp.Diagnostics.AddError( + "Missing instance_id", + "The instance_id attribute is required to create a MongoDB snapshot.", + ) + + return + } + + instanceID := locality.ExpandID(data.InstanceID.ValueString()) + + var ( + region scw.Region + err error + ) + + if !data.Region.IsNull() && data.Region.ValueString() != "" { + region = scw.Region(data.Region.ValueString()) + } else { + // Try to derive region from the instance_id if it is a regional ID. + if derivedRegion, id, parseErr := regional.ParseID(data.InstanceID.ValueString()); parseErr == nil { + region = derivedRegion + instanceID = id + } + } + + snapshotName := data.Name.ValueString() + if snapshotName == "" { + snapshotName = "tf-mongodb-snapshot" + } + + var expirationTime *time.Time + + if !data.ExpiresAt.IsNull() && data.ExpiresAt.ValueString() != "" { + expirationRaw := data.ExpiresAt.ValueString() + + parsedTime, err := time.Parse(time.RFC3339, expirationRaw) + if err != nil { + resp.Diagnostics.AddError( + "Invalid expires_at value", + fmt.Sprintf("The expires_at attribute must be a valid RFC3339 timestamp. Got %q: %s", expirationRaw, err), + ) + + return + } + + expirationTime = &parsedTime + } + + createReq := &mongodb.CreateSnapshotRequest{ + InstanceID: instanceID, + Name: snapshotName, + ExpiresAt: expirationTime, + } + + if region != "" { + createReq.Region = region + } + + snapshot, err := a.mongodbAPI.CreateSnapshot(createReq, scw.WithContext(ctx)) + if err != nil { + resp.Diagnostics.AddError( + "Error executing MongoDB CreateSnapshot action", + fmt.Sprintf("Failed to create snapshot for instance %s: %s", instanceID, err), + ) + + return + } + + if data.Wait.ValueBool() { + waitRegion := snapshot.Region + if waitRegion == "" && region != "" { + waitRegion = region + } + + if waitRegion == "" { + resp.Diagnostics.AddError( + "Missing region for wait operation", + "Could not determine region to wait for MongoDB snapshot completion.", + ) + + return + } + + _, err = waitForSnapshot(ctx, a.mongodbAPI, waitRegion, instanceID, snapshot.ID, defaultMongodbSnapshotTimeout) + if err != nil { + resp.Diagnostics.AddError( + "Error waiting for MongoDB snapshot completion", + fmt.Sprintf("Snapshot %s for instance %s did not reach a terminal state: %s", snapshot.ID, instanceID, err), + ) + + return + } + } +} diff --git a/internal/services/mongodb/action_instance_snapshot_action_test.go b/internal/services/mongodb/action_instance_snapshot_action_test.go new file mode 100644 index 0000000000..70092d335b --- /dev/null +++ b/internal/services/mongodb/action_instance_snapshot_action_test.go @@ -0,0 +1,122 @@ +package mongodb_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + mongodbSDK "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional" +) + +func TestAccActionMongoDBInstanceSnapshot_Basic(t *testing.T) { + if acctest.IsRunningOpenTofu() { + t.Skip("Skipping TestAccActionMongoDBInstanceSnapshot_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_mongodb_instance" "main" { + name = "test-mongodb-action-snapshot" + version = "7.0.12" + node_type = "MGDB-PLAY2-NANO" + node_number = 1 + user_name = "my_initial_user" + password = "thiZ_is_v&ry_s3cret" + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_mongodb_instance_snapshot_action.main] + } + } + } + + action "scaleway_mongodb_instance_snapshot_action" "main" { + config { + instance_id = scaleway_mongodb_instance.main.id + name = "tf-acc-mongodb-instance-snapshot-action" + expires_at = "2026-11-01T00:00:00Z" + wait = true + } + } + `, + }, + { + Config: ` + resource "scaleway_mongodb_instance" "main" { + name = "test-mongodb-action-snapshot" + version = "7.0.12" + node_type = "MGDB-PLAY2-NANO" + node_number = 1 + user_name = "my_initial_user" + password = "thiZ_is_v&ry_s3cret" + + lifecycle { + action_trigger { + events = [after_create] + actions = [action.scaleway_mongodb_instance_snapshot_action.main] + } + } + } + + action "scaleway_mongodb_instance_snapshot_action" "main" { + config { + instance_id = scaleway_mongodb_instance.main.id + name = "tf-acc-mongodb-instance-snapshot-action" + expires_at = "2026-11-01T00:00:00Z" + wait = true + } + } + `, + Check: resource.ComposeTestCheckFunc( + isSnapshotCreated(tt, "scaleway_mongodb_instance.main", "tf-acc-mongodb-instance-snapshot-action"), + ), + }, + }, + }) +} + +func isSnapshotCreated(tt *acctest.TestTools, instanceResourceName, snapshotName string) resource.TestCheckFunc { + return func(state *terraform.State) error { + rs, ok := state.RootModule().Resources[instanceResourceName] + if !ok { + return fmt.Errorf("resource not found: %s", instanceResourceName) + } + + instanceID := rs.Primary.ID + + region, id, err := regional.ParseID(instanceID) + if err != nil { + return fmt.Errorf("failed to parse instance ID: %w", err) + } + + api := mongodbSDK.NewAPI(tt.Meta.ScwClient()) + + snapshots, err := api.ListSnapshots(&mongodbSDK.ListSnapshotsRequest{ + Region: region, + InstanceID: &id, + }, scw.WithAllPages(), scw.WithContext(context.Background())) + if err != nil { + return fmt.Errorf("failed to list snapshots: %w", err) + } + + for _, snapshot := range snapshots.Snapshots { + if snapshot.Name == snapshotName { + return nil + } + } + + return fmt.Errorf("snapshot with name %q not found for instance %s", snapshotName, instanceID) + } +} diff --git a/internal/services/mongodb/testdata/action-mongo-db-instance-snapshot-basic.cassette.yaml b/internal/services/mongodb/testdata/action-mongo-db-instance-snapshot-basic.cassette.yaml new file mode 100644 index 0000000000..6ddab88eb2 --- /dev/null +++ b/internal/services/mongodb/testdata/action-mongo-db-instance-snapshot-basic.cassette.yaml @@ -0,0 +1,938 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 320 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","name":"test-mongodb-action-snapshot","version":"7.0","tags":null,"node_amount":1,"node_type":"MGDB-PLAY2-NANO","user_name":"my_initial_user","password":"thiZ_is_v\u0026ry_s3cret","volume":{"type":"sbs_5k","size_bytes":5000000000},"endpoints":[{"public_network":{}}]}' + 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/mongodb/v1/regions/fr-par/instances + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 690 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"provisioning","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "690" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:05:37 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: + - df1db288-64f9-4565-8989-a448c6639128 + status: 200 OK + code: 200 + duration: 616.770667ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 690 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"provisioning","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "690" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:05:37 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: + - aeb6a70d-6620-4799-8796-0398361592bf + status: 200 OK + code: 200 + duration: 100.707083ms + - id: 2 + 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 683 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"ready","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "683" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:11 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: + - cc09ca3a-5662-41f8-acad-d1f92dc5add6 + status: 200 OK + code: 200 + duration: 122.751ms + - id: 3 + 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 683 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"ready","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "683" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:12 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: + - deed10bd-2942-4830-93d0-2e16f524a022 + status: 200 OK + code: 200 + duration: 131.142166ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574/certificate + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 1085 + uncompressed: false + body: '{"content":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNBRENDQWJLZ0F3SUJBZ0lSQUxTRHVoZjFsZkI0M2NzK1htSmFsREV3QlFZREsyVndNSEF4Q3pBSkJnTlYKQkFZVEFrWlNNUTR3REFZRFZRUUhFd1ZRWVhKcGN6RVpNQmNHQTFVRUNoTVFVMk5oYkdWM1lYa2dUVzl1WjI5RQpRakUyTURRR0ExVUVDeE10U1c1emRHRnVZMlVnTW1Jd01HUTFaak10TXpKall5MDBNemN6TFRsbE1Ua3RaRGd5Ck16UTVNMlEzTlRjME1CNFhEVEkxTVRJd05ERTBNRFV6TjFvWERUTTFNVEl3TWpFME1EVXpOMW93Y0RFTE1Ba0cKQTFVRUJoTUNSbEl4RGpBTUJnTlZCQWNUQlZCaGNtbHpNUmt3RndZRFZRUUtFeEJUWTJGc1pYZGhlU0JOYjI1bgpiMFJDTVRZd05BWURWUVFMRXkxSmJuTjBZVzVqWlNBeVlqQXdaRFZtTXkwek1tTmpMVFF6TnpNdE9XVXhPUzFrCk9ESXpORGt6WkRjMU56UXdLakFGQmdNclpYQURJUUFmZm9WdG9HdGs4Qy9VQnVzZmhjR2s3d0FJQ1VJcVoxYi8KTFFDNkwzTDhWYU5oTUY4d0RnWURWUjBQQVFIL0JBUURBZ0lFTUIwR0ExVWRKUVFXTUJRR0NDc0dBUVVGQndNQwpCZ2dyQmdFRkJRY0RBVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQjBHQTFVZERnUVdCQlIwalFncTVNc1lSQzAvCnJPVmNNeHA1dGladmVqQUZCZ01yWlhBRFFRQlRDK0VJME0rR2gyai9uTE0weUhOSTZ4UE93Z0VpQVRzTU1XQlgKa29XVE9NLzJkREo5emhNUlQvQUdXUUVIRXhSTjk2bkJXUm4xQXVLVXZvd3hFY1lGCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K","content_type":"application/x-pem-file","name":"ssl_certificate"}' + headers: + Content-Length: + - "1085" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:12 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: + - 93dc1689-fbe6-4531-bed7-d2501c66ccc7 + status: 200 OK + code: 200 + duration: 23.310084ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 139 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"instance_id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"tf-acc-mongodb-instance-snapshot-action","expires_at":"2026-11-01T00:00:00Z"}' + 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/mongodb/v1/regions/fr-par/snapshots + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 433 + uncompressed: false + body: '{"created_at":"2025-12-04T14:10:12.069846Z","expires_at":"2026-11-01T00:00:00Z","id":"2b570138-1139-4d6b-9ebf-a8e4bed1d58e","instance_id":"2b00d5f3-32cc-4373-9e19-d823493d7574","instance_name":"test-mongodb-action-snapshot","name":"tf-acc-mongodb-instance-snapshot-action","node_type":"mgdb-play2-nano","region":"fr-par","size_bytes":0,"status":"creating","updated_at":"2025-12-04T14:10:12.069846Z","volume_type":"sbs_5k"}' + headers: + Content-Length: + - "433" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:12 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: + - f42caaa6-62e7-4c66-8d49-d0e693b8941b + status: 200 OK + code: 200 + duration: 245.793625ms + - id: 6 + 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/mongodb/v1/regions/fr-par/snapshots/2b570138-1139-4d6b-9ebf-a8e4bed1d58e + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 433 + uncompressed: false + body: '{"created_at":"2025-12-04T14:10:12.069846Z","expires_at":"2026-11-01T00:00:00Z","id":"2b570138-1139-4d6b-9ebf-a8e4bed1d58e","instance_id":"2b00d5f3-32cc-4373-9e19-d823493d7574","instance_name":"test-mongodb-action-snapshot","name":"tf-acc-mongodb-instance-snapshot-action","node_type":"mgdb-play2-nano","region":"fr-par","size_bytes":0,"status":"creating","updated_at":"2025-12-04T14:10:12.069846Z","volume_type":"sbs_5k"}' + headers: + Content-Length: + - "433" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:12 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: + - c7a04bf6-2ff3-44b3-9901-11cb28c2f2e6 + status: 200 OK + code: 200 + duration: 188.463542ms + - id: 7 + 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/mongodb/v1/regions/fr-par/snapshots/2b570138-1139-4d6b-9ebf-a8e4bed1d58e + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 439 + uncompressed: false + body: '{"created_at":"2025-12-04T14:10:12.069846Z","expires_at":"2026-11-01T00:00:00Z","id":"2b570138-1139-4d6b-9ebf-a8e4bed1d58e","instance_id":"2b00d5f3-32cc-4373-9e19-d823493d7574","instance_name":"test-mongodb-action-snapshot","name":"tf-acc-mongodb-instance-snapshot-action","node_type":"mgdb-play2-nano","region":"fr-par","size_bytes":5000000000,"status":"ready","updated_at":"2025-12-04T14:10:12.863314Z","volume_type":"sbs_5k"}' + headers: + Content-Length: + - "439" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10: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: + - 586cc8ce-ae3a-4acb-a5e7-2f9b7ad9febe + status: 200 OK + code: 200 + duration: 106.351541ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 683 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"ready","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "683" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:23 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: + - d6f01652-f3cb-4f87-b714-01d9f479fa22 + status: 200 OK + code: 200 + duration: 97.513292ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574/certificate + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 1085 + uncompressed: false + body: '{"content":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNBRENDQWJLZ0F3SUJBZ0lSQUxTRHVoZjFsZkI0M2NzK1htSmFsREV3QlFZREsyVndNSEF4Q3pBSkJnTlYKQkFZVEFrWlNNUTR3REFZRFZRUUhFd1ZRWVhKcGN6RVpNQmNHQTFVRUNoTVFVMk5oYkdWM1lYa2dUVzl1WjI5RQpRakUyTURRR0ExVUVDeE10U1c1emRHRnVZMlVnTW1Jd01HUTFaak10TXpKall5MDBNemN6TFRsbE1Ua3RaRGd5Ck16UTVNMlEzTlRjME1CNFhEVEkxTVRJd05ERTBNRFV6TjFvWERUTTFNVEl3TWpFME1EVXpOMW93Y0RFTE1Ba0cKQTFVRUJoTUNSbEl4RGpBTUJnTlZCQWNUQlZCaGNtbHpNUmt3RndZRFZRUUtFeEJUWTJGc1pYZGhlU0JOYjI1bgpiMFJDTVRZd05BWURWUVFMRXkxSmJuTjBZVzVqWlNBeVlqQXdaRFZtTXkwek1tTmpMVFF6TnpNdE9XVXhPUzFrCk9ESXpORGt6WkRjMU56UXdLakFGQmdNclpYQURJUUFmZm9WdG9HdGs4Qy9VQnVzZmhjR2s3d0FJQ1VJcVoxYi8KTFFDNkwzTDhWYU5oTUY4d0RnWURWUjBQQVFIL0JBUURBZ0lFTUIwR0ExVWRKUVFXTUJRR0NDc0dBUVVGQndNQwpCZ2dyQmdFRkJRY0RBVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQjBHQTFVZERnUVdCQlIwalFncTVNc1lSQzAvCnJPVmNNeHA1dGladmVqQUZCZ01yWlhBRFFRQlRDK0VJME0rR2gyai9uTE0weUhOSTZ4UE93Z0VpQVRzTU1XQlgKa29XVE9NLzJkREo5emhNUlQvQUdXUUVIRXhSTjk2bkJXUm4xQXVLVXZvd3hFY1lGCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K","content_type":"application/x-pem-file","name":"ssl_certificate"}' + headers: + Content-Length: + - "1085" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:23 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: + - cffa3c3c-07c2-45ee-8ca3-7cccb5772b4b + status: 200 OK + code: 200 + duration: 93.143125ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 683 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"ready","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "683" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:23 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: + - 161eb47f-58ea-47f6-afff-ac39368bee60 + status: 200 OK + code: 200 + duration: 118.143458ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574/certificate + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 1085 + uncompressed: false + body: '{"content":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNBRENDQWJLZ0F3SUJBZ0lSQUxTRHVoZjFsZkI0M2NzK1htSmFsREV3QlFZREsyVndNSEF4Q3pBSkJnTlYKQkFZVEFrWlNNUTR3REFZRFZRUUhFd1ZRWVhKcGN6RVpNQmNHQTFVRUNoTVFVMk5oYkdWM1lYa2dUVzl1WjI5RQpRakUyTURRR0ExVUVDeE10U1c1emRHRnVZMlVnTW1Jd01HUTFaak10TXpKall5MDBNemN6TFRsbE1Ua3RaRGd5Ck16UTVNMlEzTlRjME1CNFhEVEkxTVRJd05ERTBNRFV6TjFvWERUTTFNVEl3TWpFME1EVXpOMW93Y0RFTE1Ba0cKQTFVRUJoTUNSbEl4RGpBTUJnTlZCQWNUQlZCaGNtbHpNUmt3RndZRFZRUUtFeEJUWTJGc1pYZGhlU0JOYjI1bgpiMFJDTVRZd05BWURWUVFMRXkxSmJuTjBZVzVqWlNBeVlqQXdaRFZtTXkwek1tTmpMVFF6TnpNdE9XVXhPUzFrCk9ESXpORGt6WkRjMU56UXdLakFGQmdNclpYQURJUUFmZm9WdG9HdGs4Qy9VQnVzZmhjR2s3d0FJQ1VJcVoxYi8KTFFDNkwzTDhWYU5oTUY4d0RnWURWUjBQQVFIL0JBUURBZ0lFTUIwR0ExVWRKUVFXTUJRR0NDc0dBUVVGQndNQwpCZ2dyQmdFRkJRY0RBVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQjBHQTFVZERnUVdCQlIwalFncTVNc1lSQzAvCnJPVmNNeHA1dGladmVqQUZCZ01yWlhBRFFRQlRDK0VJME0rR2gyai9uTE0weUhOSTZ4UE93Z0VpQVRzTU1XQlgKa29XVE9NLzJkREo5emhNUlQvQUdXUUVIRXhSTjk2bkJXUm4xQXVLVXZvd3hFY1lGCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K","content_type":"application/x-pem-file","name":"ssl_certificate"}' + headers: + Content-Length: + - "1085" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:23 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: + - 0ec1bcbc-b429-4b48-924a-045b1578a078 + status: 200 OK + code: 200 + duration: 28.324667ms + - 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/mongodb/v1/regions/fr-par/snapshots?instance_id=2b00d5f3-32cc-4373-9e19-d823493d7574&order_by=created_at_asc&page=1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 472 + uncompressed: false + body: '{"snapshots":[{"created_at":"2025-12-04T14:10:12.069846Z","expires_at":"2026-11-01T00:00:00Z","id":"2b570138-1139-4d6b-9ebf-a8e4bed1d58e","instance_id":"2b00d5f3-32cc-4373-9e19-d823493d7574","instance_name":"test-mongodb-action-snapshot","name":"tf-acc-mongodb-instance-snapshot-action","node_type":"mgdb-play2-nano","region":"fr-par","size_bytes":5000000000,"status":"ready","updated_at":"2025-12-04T14:10:12.863314Z","volume_type":"sbs_5k"}],"total_count":1}' + headers: + Content-Length: + - "472" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:23 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: + - fcce882f-f797-448d-aa15-40f8123e09f0 + status: 200 OK + code: 200 + duration: 118.565958ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 683 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"ready","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "683" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:23 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: + - 3802c6bc-4810-4511-a802-5f0de425ad93 + status: 200 OK + code: 200 + duration: 28.446167ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574/certificate + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 1085 + uncompressed: false + body: '{"content":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNBRENDQWJLZ0F3SUJBZ0lSQUxTRHVoZjFsZkI0M2NzK1htSmFsREV3QlFZREsyVndNSEF4Q3pBSkJnTlYKQkFZVEFrWlNNUTR3REFZRFZRUUhFd1ZRWVhKcGN6RVpNQmNHQTFVRUNoTVFVMk5oYkdWM1lYa2dUVzl1WjI5RQpRakUyTURRR0ExVUVDeE10U1c1emRHRnVZMlVnTW1Jd01HUTFaak10TXpKall5MDBNemN6TFRsbE1Ua3RaRGd5Ck16UTVNMlEzTlRjME1CNFhEVEkxTVRJd05ERTBNRFV6TjFvWERUTTFNVEl3TWpFME1EVXpOMW93Y0RFTE1Ba0cKQTFVRUJoTUNSbEl4RGpBTUJnTlZCQWNUQlZCaGNtbHpNUmt3RndZRFZRUUtFeEJUWTJGc1pYZGhlU0JOYjI1bgpiMFJDTVRZd05BWURWUVFMRXkxSmJuTjBZVzVqWlNBeVlqQXdaRFZtTXkwek1tTmpMVFF6TnpNdE9XVXhPUzFrCk9ESXpORGt6WkRjMU56UXdLakFGQmdNclpYQURJUUFmZm9WdG9HdGs4Qy9VQnVzZmhjR2s3d0FJQ1VJcVoxYi8KTFFDNkwzTDhWYU5oTUY4d0RnWURWUjBQQVFIL0JBUURBZ0lFTUIwR0ExVWRKUVFXTUJRR0NDc0dBUVVGQndNQwpCZ2dyQmdFRkJRY0RBVEFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQjBHQTFVZERnUVdCQlIwalFncTVNc1lSQzAvCnJPVmNNeHA1dGladmVqQUZCZ01yWlhBRFFRQlRDK0VJME0rR2gyai9uTE0weUhOSTZ4UE93Z0VpQVRzTU1XQlgKa29XVE9NLzJkREo5emhNUlQvQUdXUUVIRXhSTjk2bkJXUm4xQXVLVXZvd3hFY1lGCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K","content_type":"application/x-pem-file","name":"ssl_certificate"}' + headers: + Content-Length: + - "1085" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:24 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: + - c2e3991e-028f-48eb-afe5-abb5cce60556 + status: 200 OK + code: 200 + duration: 90.469625ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 683 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"ready","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "683" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:24 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: + - 833a3c11-a2d0-46b3-9df7-a8da66da9f03 + status: 200 OK + code: 200 + duration: 30.802875ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 569 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":null,"status":"deleting","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "569" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:24 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: + - 8d8a1ee6-93c6-4ae6-bc93-21bdc39913cb + status: 200 OK + code: 200 + duration: 177.707375ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 686 + uncompressed: false + body: '{"created_at":"2025-12-04T14:05:36.789124Z","endpoints":[{"dns_record":"2b00d5f3-32cc-4373-9e19-d823493d7574.mgdb.fr-par.scw.cloud","id":"e6b73c7c-56a4-470d-b73e-62b492e22cf6","port":27017,"public_network":{}}],"id":"2b00d5f3-32cc-4373-9e19-d823493d7574","name":"test-mongodb-action-snapshot","node_amount":1,"node_type":"mgdb-play2-nano","organization_id":"","project_id":"105bdce1-64c0-48ab-899d-868455867ecf","region":"fr-par","snapshot_schedule":{"enabled":false,"frequency_hours":24,"last_run":null,"next_update":"2025-12-04T14:05:37.249145Z","retention_days":7},"status":"deleting","tags":[],"version":"7.0","volume":{"size_bytes":5000000000,"type":"sbs_5k"}}' + headers: + Content-Length: + - "686" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:24 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: + - 9c72d3a3-0c80-4a0a-9d83-94e00f082056 + status: 200 OK + code: 200 + duration: 92.515833ms + - 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/mongodb/v1/regions/fr-par/instances/2b00d5f3-32cc-4373-9e19-d823493d7574 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 129 + uncompressed: false + body: '{"message":"resource is not found","resource":"instance","resource_id":"2b00d5f3-32cc-4373-9e19-d823493d7574","type":"not_found"}' + headers: + Content-Length: + - "129" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 04 Dec 2025 14:10:44 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: + - 674c2a4c-3f66-4934-b8dc-cd7968db0ebf + status: 404 Not Found + code: 404 + duration: 32.439125ms diff --git a/provider/framework.go b/provider/framework.go index 03dedf8db3..6acf9bceb8 100644 --- a/provider/framework.go +++ b/provider/framework.go @@ -14,6 +14,7 @@ import ( "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/instance" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/mongodb" ) var ( @@ -138,6 +139,7 @@ func (p *ScalewayProvider) Actions(_ context.Context) []func() action.Action { var res []func() action.Action res = append(res, instance.NewServerAction) + res = append(res, mongodb.NewInstanceSnapshotAction) return res } diff --git a/templates/actions/mongodb_instance_snapshot_action.md.tmpl b/templates/actions/mongodb_instance_snapshot_action.md.tmpl new file mode 100644 index 0000000000..7ecfbc0711 --- /dev/null +++ b/templates/actions/mongodb_instance_snapshot_action.md.tmpl @@ -0,0 +1,9 @@ +{{- /*gotype: github.com/hashicorp/terraform-plugin-docs/internal/provider.ActionTemplateType */ -}} +--- +subcategory: "MongoDB" +page_title: "Scaleway: scaleway_mongodb_instance_snapshot_action" +--- + +# scaleway_mongodb_instance_snapshot_action (Action) + +{{ .SchemaMarkdown }}