diff --git a/.github/labeler.yml b/.github/labeler.yml index f9c3a44c96..b7e69ab91a 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -117,3 +117,8 @@ webhosting: - changed-files: - any-glob-to-any-file: - internal/services/webhosting/** +file: + - changed-files: + - any-glob-to-any-file: + - internal/services/file/** + diff --git a/.github/workflows/acceptance-tests.yaml b/.github/workflows/acceptance-tests.yaml index 6f1ca9b13b..01fc3743c3 100644 --- a/.github/workflows/acceptance-tests.yaml +++ b/.github/workflows/acceptance-tests.yaml @@ -19,6 +19,7 @@ jobs: - cockpit - container - domain + - file - flexibleip - function - iam diff --git a/docs/resources/file_filesystem.md b/docs/resources/file_filesystem.md new file mode 100644 index 0000000000..2da3bca5f1 --- /dev/null +++ b/docs/resources/file_filesystem.md @@ -0,0 +1,52 @@ +--- +subcategory: "File" +page_title: "Scaleway: scaleway_file_filesystem" +--- + +# Resource: scaleway_file_filesystem + +Creates and manages a Scaleway File Storage (NFS) filesystem in a specific region. A filesystem is a scalable storage resource that can be mounted on Compute instances and is typically used for shared, persistent storage. + +This resource allows you to define and manage the size, tags, and region of a filesystem, and track its creation and update timestamps, current status, and number of active attachments. + +## Example Usage + +### Basic + +```terraform +resource scaleway_file_filesystem file { + name = "my-nfs-filesystem" + size = 100000000000 # 100 GB +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the filesystem. If not provided, a random name will be generated. +- `size` - (Required) The size of the filesystem in bytes, with a granularity of 100 GB (10ยนยน bytes). + - Minimum: 100 GB (100000000000 bytes) + - Maximum: 10 TB (10000000000000 bytes) +- `tags` - (Optional) A list of tags associated with the filesystem. +- `region` - (Defaults to [provider](../index.md#region) `region`) The region where the filesystem will be created (e.g., fr-par, nl-ams). +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the server is + associated with. +- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the user is associated with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the filesystem. +- `status` - The current status of the filesystem. Possible values include creating, available, etc. +- `number_of_attachments` - The number of active attachments (mounts) on the filesystem. +- `created_at` - The date and time when the File Storage filesystem was created. +- `updated_at` - The date and time of the last update to the File Storage filesystem. + +## Import + + +File Storage filesystems can be imported using the `{region}/{id}`, e.g. + +```bash +terraform import scaleway_file_filesystem.main fr-par/11111111-1111-1111-1111-111111111111 +``` \ No newline at end of file diff --git a/go.mod b/go.mod index c88b01cd4f..d1d8df4589 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/nats-io/jwt/v2 v2.7.4 github.com/nats-io/nats.go v1.38.0 github.com/robfig/cron/v3 v3.0.1 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250512145715-0fc65cc3636b + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250604134054-a06406d42247 github.com/stretchr/testify v1.10.0 golang.org/x/crypto v0.38.0 gopkg.in/dnaeon/go-vcr.v3 v3.2.0 diff --git a/go.sum b/go.sum index c4b5dd5d78..621be86917 100644 --- a/go.sum +++ b/go.sum @@ -447,8 +447,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250512145715-0fc65cc3636b h1:wzu3hPSNK2PPo7OXBzofeS5hOWqnVRP8xqIXom9ufoc= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250512145715-0fc65cc3636b/go.mod h1:qiGzapFyNPFwBBLJ+hTFykKSnU95n1zL64+o1ubmwf0= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250604134054-a06406d42247 h1:wlIvcSpGl3mGDpQmwrZHnYMIlB7Mwx3bhg151LG22Ws= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250604134054-a06406d42247/go.mod h1:qiGzapFyNPFwBBLJ+hTFykKSnU95n1zL64+o1ubmwf0= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= diff --git a/internal/acctest/validate_cassettes_test.go b/internal/acctest/validate_cassettes_test.go index 3dedec9208..3e91392ce7 100644 --- a/internal/acctest/validate_cassettes_test.go +++ b/internal/acctest/validate_cassettes_test.go @@ -17,16 +17,18 @@ import ( func exceptionsCassettesCases() map[string]struct{} { return map[string]struct{}{ - "../services/mnq/testdata/sns-topic-basic.cassette.yaml": {}, - "../services/mnq/testdata/sns-topic-subscription-basic.cassette.yaml": {}, - "../services/mnq/testdata/sqs-already-activated.cassette.yaml": {}, - "../services/object/testdata/bucket-cors-empty-origin.cassette.yaml": {}, - "../services/object/testdata/bucket-destroy-force.cassette.yaml": {}, - "../services/rdb/testdata/data-source-privilege-basic.cassette.yaml": {}, - "../services/rdb/testdata/privilege-basic.cassette.yaml": {}, - "../services/object/testdata/object-bucket-destroy-force.cassette.yaml": {}, - "../services/secret/testdata/secret-protected.cassette.yaml": {}, - "../services/secret/testdata/secret-version-type.cassette.yaml": {}, + "../services/mnq/testdata/sns-topic-basic.cassette.yaml": {}, + "../services/mnq/testdata/sns-topic-subscription-basic.cassette.yaml": {}, + "../services/mnq/testdata/sqs-already-activated.cassette.yaml": {}, + "../services/object/testdata/bucket-cors-empty-origin.cassette.yaml": {}, + "../services/object/testdata/bucket-destroy-force.cassette.yaml": {}, + "../services/rdb/testdata/data-source-privilege-basic.cassette.yaml": {}, + "../services/rdb/testdata/privilege-basic.cassette.yaml": {}, + "../services/object/testdata/object-bucket-destroy-force.cassette.yaml": {}, + "../services/secret/testdata/secret-protected.cassette.yaml": {}, + "../services/secret/testdata/secret-version-type.cassette.yaml": {}, + "../services/file/testdata/file-system-invalid-size-granularity-fails.cassette.yaml": {}, + "../services/file/testdata/file-system-size-too-small-fails.cassette.yaml": {}, } } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 4606f4c612..6d33d51993 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -21,6 +21,7 @@ import ( "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/container" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/domain" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/edgeservices" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/file" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/flexibleip" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/function" "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/iam" @@ -151,6 +152,7 @@ func Provider(config *Config) plugin.ProviderFunc { "scaleway_edge_services_route_stage": edgeservices.ResourceRouteStage(), "scaleway_edge_services_tls_stage": edgeservices.ResourceTLSStage(), "scaleway_edge_services_waf_stage": edgeservices.ResourceWAFStage(), + "scaleway_file_filesystem": file.ResourceFileSystem(), "scaleway_flexible_ip": flexibleip.ResourceIP(), "scaleway_flexible_ip_mac_address": flexibleip.ResourceMACAddress(), "scaleway_function": function.ResourceFunction(), diff --git a/internal/services/file/filesystem.go b/internal/services/file/filesystem.go new file mode 100644 index 0000000000..2bf9f3b390 --- /dev/null +++ b/internal/services/file/filesystem.go @@ -0,0 +1,212 @@ +package file + +import ( + "context" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + file "github.com/scaleway/scaleway-sdk-go/api/file/v1alpha1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/types" +) + +func ResourceFileSystem() *schema.Resource { + return &schema.Resource{ + CreateContext: ResourceFileSystemCreate, + ReadContext: ResourceFileSystemRead, + UpdateContext: ResourceFileSystemUpdate, + DeleteContext: ResourceFileSystemDelete, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(defaultFileSystemTimeout), + Read: schema.DefaultTimeout(defaultFileSystemTimeout), + Delete: schema.DefaultTimeout(defaultFileSystemTimeout), + Default: schema.DefaultTimeout(defaultFileSystemTimeout), + }, + SchemaVersion: 0, + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Optional: true, + Description: "The name of the filesystem", + }, + "size": { + Type: schema.TypeInt, + Required: true, + Description: "The Filesystem size in bytes, with a granularity of 100 GB (10^11 bytes). Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size.", + }, + "tags": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Description: "The list of tags assigned to the filesystem", + }, + "project_id": account.ProjectIDSchema(), + "organization_id": account.OrganizationIDSchema(), + "region": regional.Schema(), + "status": { + Type: schema.TypeString, + Computed: true, + Description: "The Current status of the filesystem (e.g. creating, available, ...)", + }, + "number_of_attachments": { + Type: schema.TypeInt, + Computed: true, + Description: "The current number of attachments (mounts) that the filesystem has", + }, + "created_at": { + Type: schema.TypeString, + Computed: true, + Description: "The creation date of the filesystem", + }, + "updated_at": { + Type: schema.TypeString, + Computed: true, + Description: "The last update date of the properties of the filesystem", + }, + }, + } +} + +func ResourceFileSystemCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + api, region, err := fileSystemAPIWithZone(d, m) + if err != nil { + return diag.FromErr(err) + } + + req := &file.CreateFileSystemRequest{ + Region: region, + Name: types.ExpandOrGenerateString(d.Get("name").(string), "file"), + ProjectID: d.Get("project_id").(string), + Size: *types.ExpandUint64Ptr(d.Get("size")), + Tags: types.ExpandStrings(d.Get("tags")), + } + + file, err := api.CreateFileSystem(req, scw.WithContext(ctx)) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(regional.NewIDString(region, file.ID)) + + _, err = waitForFileSystem(ctx, api, region, file.ID, d.Timeout(schema.TimeoutCreate)) + if err != nil { + return diag.FromErr(err) + } + + return ResourceFileSystemRead(ctx, d, m) +} + +func ResourceFileSystemRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + api, region, id, err := NewAPIWithRegionAndID(m, d.Id()) + if err != nil { + return diag.FromErr(err) + } + + fileSystem, err := waitForFileSystem(ctx, api, region, id, d.Timeout(schema.TimeoutRead)) + if err != nil { + if httperrors.Is404(err) { + d.SetId("") + + return nil + } + + return diag.FromErr(err) + } + + _ = d.Set("name", fileSystem.Name) + _ = d.Set("project_id", fileSystem.ProjectID) + _ = d.Set("region", fileSystem.Region) + _ = d.Set("organization_id", fileSystem.OrganizationID) + _ = d.Set("status", fileSystem.Status) + _ = d.Set("size", int64(fileSystem.Size)) + _ = d.Set("tags", fileSystem.Tags) + _ = d.Set("created_at", fileSystem.CreatedAt.Format(time.RFC3339)) + _ = d.Set("updated_at", fileSystem.UpdatedAt.Format(time.RFC3339)) + _ = d.Set("number_of_attachments", int64(fileSystem.NumberOfAttachments)) + + return nil +} + +func ResourceFileSystemUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + api, region, id, err := NewAPIWithRegionAndID(m, d.Id()) + if err != nil { + return diag.FromErr(err) + } + + fileSystem, err := waitForFileSystem(ctx, api, region, id, d.Timeout(schema.TimeoutUpdate)) + if err != nil { + if httperrors.Is404(err) { + d.SetId("") + + return nil + } + + return diag.FromErr(err) + } + + req := &file.UpdateFileSystemRequest{ + Region: region, + FilesystemID: fileSystem.ID, + } + + if d.HasChange("name") { + req.Name = types.ExpandUpdatedStringPtr(d.Get("name")) + } + + if d.HasChange("size") { + req.Size = types.ExpandUint64Ptr(d.Get("size")) + } + + if d.HasChange("tags") { + req.Tags = types.ExpandStringsPtr(d.Get("tags")) + } + + if _, err := api.UpdateFileSystem(req, scw.WithContext(ctx)); err != nil { + return diag.FromErr(err) + } + + return ResourceFileSystemRead(ctx, d, m) +} + +func ResourceFileSystemDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + api, region, id, err := NewAPIWithRegionAndID(m, d.Id()) + if err != nil { + return diag.FromErr(err) + } + + _, err = waitForFileSystem(ctx, api, region, id, d.Timeout(schema.TimeoutDelete)) + if err != nil { + if httperrors.Is404(err) { + d.SetId("") + + return nil + } + + return diag.FromErr(err) + } + + err = api.DeleteFileSystem(&file.DeleteFileSystemRequest{ + Region: region, + FilesystemID: id, + }, scw.WithContext(ctx)) + if err != nil { + return diag.FromErr(err) + } + + _, err = waitForFileSystem(ctx, api, region, id, d.Timeout(schema.TimeoutDelete)) + if err != nil && !httperrors.Is404(err) { + return diag.FromErr(err) + } + + return nil +} diff --git a/internal/services/file/filesystem_test.go b/internal/services/file/filesystem_test.go new file mode 100644 index 0000000000..06b2347997 --- /dev/null +++ b/internal/services/file/filesystem_test.go @@ -0,0 +1,131 @@ +package file_test + +import ( + "fmt" + "regexp" + "strconv" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + fileSDK "github.com/scaleway/scaleway-sdk-go/api/file/v1alpha1" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/file" + filetestfuncs "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/file/testfuncs" +) + +func TestAccFileSystem_Basic(t *testing.T) { + tt := acctest.NewTestTools(t) + defer tt.Cleanup() + + fileSystemName := "TestAccFileSystem_Basic" + fileSystemNameUpdated := "TestAccFileSystem_BasicUpdate" + size := int64(100_000_000_000) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProviderFactories: tt.ProviderFactories, + CheckDestroy: filetestfuncs.CheckFileDestroy(tt), + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` + resource "scaleway_file_filesystem" "fs" { + name = "%s" + size = %d + } + `, fileSystemName, size), + Check: resource.ComposeTestCheckFunc( + testAccCheckFileSystemExists(tt, "scaleway_file_filesystem.fs"), + resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "name", fileSystemName), + resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "size", strconv.FormatInt(size, 10)), + ), + }, + { + Config: fmt.Sprintf(` + resource "scaleway_file_filesystem" "fs" { + name = "%s" + size = %d + } + `, fileSystemNameUpdated, size), + Check: resource.ComposeTestCheckFunc( + testAccCheckFileSystemExists(tt, "scaleway_file_filesystem.fs"), + resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "size", strconv.FormatInt(size, 10)), + ), + }, + }, + }) +} + +func TestAccFileSystem_SizeTooSmallFails(t *testing.T) { + tt := acctest.NewTestTools(t) + defer tt.Cleanup() + + fileSystemName := "TestAccFileSystem_SizeTooSmallFails" + size := int64(10_000_000_000) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProviderFactories: tt.ProviderFactories, + CheckDestroy: filetestfuncs.CheckFileDestroy(tt), + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` + resource "scaleway_file_filesystem" "fs" { + name = "%s" + size = %d + } + `, fileSystemName, size), + ExpectError: regexp.MustCompile("size must be greater or equal to 100000000000"), + }, + }, + }) +} + +func TestAccFileSystem_InvalidSizeGranularityFails(t *testing.T) { + tt := acctest.NewTestTools(t) + defer tt.Cleanup() + + fileSystemName := "TestAccFileSystem_InvalidSizeGranularityFails" + size := int64(25_000_000_000) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProviderFactories: tt.ProviderFactories, + CheckDestroy: filetestfuncs.CheckFileDestroy(tt), + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` + resource "scaleway_file_filesystem" "fs" { + name = "%s" + size = %d + } + `, fileSystemName, size), + ExpectError: regexp.MustCompile("size must be greater or equal to 100000000000"), + }, + }, + }) +} + +func testAccCheckFileSystemExists(tt *acctest.TestTools, n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("resource not found: %s", n) + } + + fileAPI, region, id, err := file.NewAPIWithRegionAndID(tt.Meta, rs.Primary.ID) + if err != nil { + return err + } + + _, err = fileAPI.GetFileSystem(&fileSDK.GetFileSystemRequest{ + Region: region, + FilesystemID: id, + }) + if err != nil { + return err + } + + return nil + } +} diff --git a/internal/services/file/helpers_file.go b/internal/services/file/helpers_file.go new file mode 100644 index 0000000000..b66bd75370 --- /dev/null +++ b/internal/services/file/helpers_file.go @@ -0,0 +1,38 @@ +package file + +import ( + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + file "github.com/scaleway/scaleway-sdk-go/api/file/v1alpha1" + "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" +) + +const ( + defaultFileSystemTimeout = 5 * time.Minute + defaultFileSystemRetryInterval = 5 * time.Second +) + +func fileSystemAPIWithZone(d *schema.ResourceData, m interface{}) (*file.API, scw.Region, error) { + fileAPI := file.NewAPI(meta.ExtractScwClient(m)) + + region, err := meta.ExtractRegion(d, m) + if err != nil { + return nil, "", err + } + + return fileAPI, region, nil +} + +func NewAPIWithRegionAndID(m interface{}, regionID string) (*file.API, scw.Region, string, error) { + fileAPI := file.NewAPI(meta.ExtractScwClient(m)) + + region, ID, err := regional.ParseID(regionID) + if err != nil { + return nil, "", "", err + } + + return fileAPI, region, ID, nil +} diff --git a/internal/services/file/testdata/file-system-basic.cassette.yaml b/internal/services/file/testdata/file-system-basic.cassette.yaml new file mode 100644 index 0000000000..a5a78bd993 --- /dev/null +++ b/internal/services/file/testdata/file-system-basic.cassette.yaml @@ -0,0 +1,789 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 116 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"name":"TestAccFileSystem_Basic","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","size":100000000000,"tags":[]}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 377 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"creating","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "377" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:33 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 4df7f46a-4ead-45db-9d5f-b9e3ff8e472c + status: 200 OK + code: 200 + duration: 274.625083ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 377 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"creating","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "377" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:33 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 84d60524-ece9-4219-925a-fd3d5238e121 + status: 200 OK + code: 200 + duration: 78.254833ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 378 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "378" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:38 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 20f8bc16-b5f3-4aa8-93db-7e2110d7226f + status: 200 OK + code: 200 + duration: 226.728042ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 378 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "378" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:38 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 85533205-70f3-4507-8a2e-b5b5c872db7d + status: 200 OK + code: 200 + duration: 72.933083ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 378 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "378" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:38 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - ffb6ba44-4198-402b-bade-9d1056f62c1e + status: 200 OK + code: 200 + duration: 93.981208ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 378 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "378" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:39 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 8d1980a9-616d-4cb7-8379-a965875aa615 + status: 200 OK + code: 200 + duration: 147.937375ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 378 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "378" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:40 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 279f4589-9a60-4355-af18-b065577575c3 + status: 200 OK + code: 200 + duration: 96.605459ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 378 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_Basic","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "378" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:41 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - f8975b8a-e0ed-45c2-9a8f-346bf790a5dc + status: 200 OK + code: 200 + duration: 73.752958ms + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 40 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"name":"TestAccFileSystem_BasicUpdate"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 384 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_BasicUpdate","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "384" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:41 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 51ef71a4-08af-419a-81e4-5909b1c7b3f8 + status: 200 OK + code: 200 + duration: 360.532708ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 384 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_BasicUpdate","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "384" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:41 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - e9b678e6-2fa3-4f6c-9d33-dc266b7b6768 + status: 200 OK + code: 200 + duration: 119.121167ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 384 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_BasicUpdate","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "384" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:42 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 50f62ab1-20a2-464c-89ed-a2e379cbf195 + status: 200 OK + code: 200 + duration: 216.022333ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 384 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_BasicUpdate","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "384" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:42 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 65c3582f-73c5-4b28-8965-c819f2a6fae1 + status: 200 OK + code: 200 + duration: 162.31775ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 384 + uncompressed: false + body: '{"created_at":"2025-06-05T14:14:33.172071Z","id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","name":"TestAccFileSystem_BasicUpdate","number_of_attachments":0,"organization_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","region":"fr-par","size":100000000000,"status":"available","tags":[],"updated_at":"2025-06-05T14:14:33.172071Z"}' + headers: + Content-Length: + - "384" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:43 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - fe3263a9-6ccc-4d2f-9f86-2c4b3a5d4667 + status: 200 OK + code: 200 + duration: 137.156792ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + 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, 05 Jun 2025 14:14:44 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 190f61ce-0cbc-41e7-9bad-d44345208cba + status: 204 No Content + code: 204 + duration: 132.4795ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 131 + uncompressed: false + body: '{"message":"resource is not found","resource":"filesystem","resource_id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","type":"not_found"}' + headers: + Content-Length: + - "131" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:44 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - aea2d290-84b6-4302-ad90-f87143eb6f06 + status: 404 Not Found + code: 404 + duration: 87.874208ms + - 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.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems/19c1099a-95a9-4ddb-85c4-1c609dfc4d34 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 131 + uncompressed: false + body: '{"message":"resource is not found","resource":"filesystem","resource_id":"19c1099a-95a9-4ddb-85c4-1c609dfc4d34","type":"not_found"}' + headers: + Content-Length: + - "131" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 14:14:44 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - f458d891-e526-49da-99c3-8da82a0b0ef9 + status: 404 Not Found + code: 404 + duration: 86.334708ms diff --git a/internal/services/file/testdata/file-system-invalid-size-granularity-fails.cassette.yaml b/internal/services/file/testdata/file-system-invalid-size-granularity-fails.cassette.yaml new file mode 100644 index 0000000000..3706bfef8a --- /dev/null +++ b/internal/services/file/testdata/file-system-invalid-size-granularity-fails.cassette.yaml @@ -0,0 +1,54 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 137 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"name":"TestAccFileSystem_InvalidSizeGranularityFails","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","size":25000000000,"tags":[]}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 182 + uncompressed: false + body: '{"details":[{"argument_name":"size","help_message":"size must be greater or equal to 100000000000","reason":"constraint"}],"message":"invalid argument(s)","type":"invalid_arguments"}' + headers: + Content-Length: + - "182" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 15:04:00 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 1a3119e1-bf60-4f56-ae77-75a725054db8 + status: 400 Bad Request + code: 400 + duration: 184.383ms diff --git a/internal/services/file/testdata/file-system-size-too-small-fails.cassette.yaml b/internal/services/file/testdata/file-system-size-too-small-fails.cassette.yaml new file mode 100644 index 0000000000..11bfd1ce3b --- /dev/null +++ b/internal/services/file/testdata/file-system-size-too-small-fails.cassette.yaml @@ -0,0 +1,54 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 127 + transfer_encoding: [] + trailer: {} + host: api.scaleway.com + remote_addr: "" + request_uri: "" + body: '{"name":"TestAccFileSystem_SizeTooSmallFails","project_id":"d3520a52-2c75-4ba0-bda8-82dd087f07f2","size":10000000000,"tags":[]}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.1; darwin; arm64) terraform-provider/develop terraform/terraform-tests + url: https://api.scaleway.com/file/v1alpha1/regions/fr-par/filesystems + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 182 + uncompressed: false + body: '{"details":[{"argument_name":"size","help_message":"size must be greater or equal to 100000000000","reason":"constraint"}],"message":"invalid argument(s)","type":"invalid_arguments"}' + headers: + Content-Length: + - "182" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Thu, 05 Jun 2025 15:04:02 GMT + Server: + - Scaleway API Gateway (fr-par-1;edge01) + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 1fb11366-c9f7-412e-883d-fc8dd92c0d3d + status: 400 Bad Request + code: 400 + duration: 309.532458ms diff --git a/internal/services/file/testfuncs/checks.go b/internal/services/file/testfuncs/checks.go new file mode 100644 index 0000000000..9aa1a9d128 --- /dev/null +++ b/internal/services/file/testfuncs/checks.go @@ -0,0 +1,42 @@ +package filetestfuncs + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + fileSDK "github.com/scaleway/scaleway-sdk-go/api/file/v1alpha1" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/acctest" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/file" +) + +func CheckFileDestroy(tt *acctest.TestTools) resource.TestCheckFunc { + return func(state *terraform.State) error { + for _, rs := range state.RootModule().Resources { + if rs.Type != "scaleway_file_filesystem" { + continue + } + + fileAPI, region, id, err := file.NewAPIWithRegionAndID(tt.Meta, rs.Primary.ID) + if err != nil { + return err + } + + _, err = fileAPI.GetFileSystem(&fileSDK.GetFileSystemRequest{ + Region: region, + FilesystemID: id, + }) + + if err == nil { + return fmt.Errorf("filesystem (%s) still exists", rs.Primary.ID) + } + + if !httperrors.Is404(err) { + return err + } + } + + return nil + } +} diff --git a/internal/services/file/waiter.go b/internal/services/file/waiter.go new file mode 100644 index 0000000000..f8254716de --- /dev/null +++ b/internal/services/file/waiter.go @@ -0,0 +1,26 @@ +package file + +import ( + "context" + "time" + + file "github.com/scaleway/scaleway-sdk-go/api/file/v1alpha1" + "github.com/scaleway/scaleway-sdk-go/scw" + "github.com/scaleway/terraform-provider-scaleway/v2/internal/transport" +) + +func waitForFileSystem(ctx context.Context, fileAPI *file.API, region scw.Region, id string, timeout time.Duration) (*file.FileSystem, error) { + retryInterval := defaultFileSystemRetryInterval + if transport.DefaultWaitRetryInterval != nil { + retryInterval = *transport.DefaultWaitRetryInterval + } + + fileSystem, err := fileAPI.WaitForFileSystem(&file.WaitForFileSystemRequest{ + FileSystemID: id, + Region: region, + Timeout: scw.TimeDurationPtr(timeout), + RetryInterval: &retryInterval, + }, scw.WithContext(ctx)) + + return fileSystem, err +}