Skip to content

Commit 28052de

Browse files
committed
fix(file): rename attribut size to size_in_gb
1 parent d38c38c commit 28052de

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

docs/resources/file_filesystem.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ This resource allows you to define and manage the size, tags, and region of a fi
1616
```terraform
1717
resource scaleway_file_filesystem file {
1818
name = "my-nfs-filesystem"
19-
size = 100000000000 # 100 GB
19+
size_in_gb = 100000000000 # 100 GB
2020
}
2121
```
2222

2323
## Argument Reference
2424

2525
- `name` - (Optional) The name of the filesystem. If not provided, a random name will be generated.
26-
- `size` - (Required) The size of the filesystem in bytes, with a granularity of 100 GB (10¹¹ bytes).
26+
- `size_in_gb` - (Required) The size of the filesystem in bytes, with a granularity of 100 GB (10¹¹ bytes).
2727
- Minimum: 100 GB (100000000000 bytes)
2828
- Maximum: 10 TB (10000000000000 bytes)
2929
- `tags` - (Optional) A list of tags associated with the filesystem.

docs/resources/instance_server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ resource scaleway_block_volume volume {
5555
5656
resource scaleway_file_filesystem terraform_instance_filesystem {
5757
name = "filesystem-instance-terraform"
58-
size = 100000000000
58+
size_in_gb = 100000000000
5959
}
6060
6161
resource scaleway_instance_server base {

internal/services/file/filesystem.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ func ResourceFileSystem() *schema.Resource {
3737
Optional: true,
3838
Description: "The name of the filesystem",
3939
},
40-
"size": {
40+
"size_in_gb": {
4141
Type: schema.TypeInt,
4242
Required: true,
43-
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.",
43+
Description: "The Filesystem size_in_gb 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_in_gb.",
4444
},
4545
"tags": {
4646
Type: schema.TypeList,
@@ -87,7 +87,7 @@ func ResourceFileSystemCreate(ctx context.Context, d *schema.ResourceData, m any
8787
Region: region,
8888
Name: types.ExpandOrGenerateString(d.Get("name").(string), "file"),
8989
ProjectID: d.Get("project_id").(string),
90-
Size: *types.ExpandUint64Ptr(d.Get("size")),
90+
Size: *types.ExpandUint64Ptr(d.Get("size_in_gb")),
9191
Tags: types.ExpandStrings(d.Get("tags")),
9292
}
9393

@@ -128,7 +128,7 @@ func ResourceFileSystemRead(ctx context.Context, d *schema.ResourceData, m any)
128128
_ = d.Set("region", fileSystem.Region)
129129
_ = d.Set("organization_id", fileSystem.OrganizationID)
130130
_ = d.Set("status", fileSystem.Status)
131-
_ = d.Set("size", int64(fileSystem.Size))
131+
_ = d.Set("size_in_gb", int64(fileSystem.Size))
132132
_ = d.Set("tags", fileSystem.Tags)
133133
_ = d.Set("created_at", fileSystem.CreatedAt.Format(time.RFC3339))
134134
_ = d.Set("updated_at", fileSystem.UpdatedAt.Format(time.RFC3339))
@@ -163,8 +163,8 @@ func ResourceFileSystemUpdate(ctx context.Context, d *schema.ResourceData, m any
163163
req.Name = types.ExpandUpdatedStringPtr(d.Get("name"))
164164
}
165165

166-
if d.HasChange("size") {
167-
req.Size = types.ExpandUint64Ptr(d.Get("size"))
166+
if d.HasChange("size_in_gb_in_gb") {
167+
req.Size = types.ExpandUint64Ptr(d.Get("size_in_gb"))
168168
}
169169

170170
if d.HasChange("tags") {

internal/services/file/filesystem_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestAccFileSystem_Basic(t *testing.T) {
2020

2121
fileSystemName := "TestAccFileSystem_Basic"
2222
fileSystemNameUpdated := "TestAccFileSystem_BasicUpdate"
23-
size := int64(100_000_000_000)
23+
sizeInGB := int64(100_000_000_000)
2424

2525
resource.ParallelTest(t, resource.TestCase{
2626
PreCheck: func() { acctest.PreCheck(t) },
@@ -31,25 +31,25 @@ func TestAccFileSystem_Basic(t *testing.T) {
3131
Config: fmt.Sprintf(`
3232
resource "scaleway_file_filesystem" "fs" {
3333
name = "%s"
34-
size = %d
34+
size_in_gb = %d
3535
}
36-
`, fileSystemName, size),
36+
`, fileSystemName, sizeInGB),
3737
Check: resource.ComposeTestCheckFunc(
3838
testAccCheckFileSystemExists(tt, "scaleway_file_filesystem.fs"),
3939
resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "name", fileSystemName),
40-
resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "size", strconv.FormatInt(size, 10)),
40+
resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "size_in_gb", strconv.FormatInt(sizeInGB, 10)),
4141
),
4242
},
4343
{
4444
Config: fmt.Sprintf(`
4545
resource "scaleway_file_filesystem" "fs" {
4646
name = "%s"
47-
size = %d
47+
size_in_gb = %d
4848
}
49-
`, fileSystemNameUpdated, size),
49+
`, fileSystemNameUpdated, sizeInGB),
5050
Check: resource.ComposeTestCheckFunc(
5151
testAccCheckFileSystemExists(tt, "scaleway_file_filesystem.fs"),
52-
resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "size", strconv.FormatInt(size, 10)),
52+
resource.TestCheckResourceAttr("scaleway_file_filesystem.fs", "size_in_gb", strconv.FormatInt(sizeInGB, 10)),
5353
),
5454
},
5555
},
@@ -61,7 +61,7 @@ func TestAccFileSystem_SizeTooSmallFails(t *testing.T) {
6161
defer tt.Cleanup()
6262

6363
fileSystemName := "TestAccFileSystem_SizeTooSmallFails"
64-
size := int64(10_000_000_000)
64+
sizeInGB := int64(10_000_000_000)
6565

6666
resource.ParallelTest(t, resource.TestCase{
6767
PreCheck: func() { acctest.PreCheck(t) },
@@ -72,9 +72,9 @@ func TestAccFileSystem_SizeTooSmallFails(t *testing.T) {
7272
Config: fmt.Sprintf(`
7373
resource "scaleway_file_filesystem" "fs" {
7474
name = "%s"
75-
size = %d
75+
size_in_gb = %d
7676
}
77-
`, fileSystemName, size),
77+
`, fileSystemName, sizeInGB),
7878
ExpectError: regexp.MustCompile("size must be greater or equal to 100000000000"),
7979
},
8080
},
@@ -86,7 +86,7 @@ func TestAccFileSystem_InvalidSizeGranularityFails(t *testing.T) {
8686
defer tt.Cleanup()
8787

8888
fileSystemName := "TestAccFileSystem_InvalidSizeGranularityFails"
89-
size := int64(25_000_000_000)
89+
sizeInGB := int64(25_000_000_000)
9090

9191
resource.ParallelTest(t, resource.TestCase{
9292
PreCheck: func() { acctest.PreCheck(t) },
@@ -97,10 +97,10 @@ func TestAccFileSystem_InvalidSizeGranularityFails(t *testing.T) {
9797
Config: fmt.Sprintf(`
9898
resource "scaleway_file_filesystem" "fs" {
9999
name = "%s"
100-
size = %d
100+
size_in_gb = %d
101101
}
102-
`, fileSystemName, size),
103-
ExpectError: regexp.MustCompile("size must be greater or equal to 100000000000"),
102+
`, fileSystemName, sizeInGB),
103+
ExpectError: regexp.MustCompile("size_in_gb must be greater or equal to 100000000000"),
104104
},
105105
},
106106
})

0 commit comments

Comments
 (0)