Skip to content

Commit b015c8f

Browse files
committed
fix(instance): update schema filesystem
1 parent a85e52b commit b015c8f

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

internal/services/instance/server.go

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,26 @@ func ResourceServer() *schema.Resource {
190190
Optional: true,
191191
Description: "The additional volumes attached to the server",
192192
},
193-
"filesystem_ids": {
194-
Type: schema.TypeList,
195-
Elem: &schema.Schema{
196-
Type: schema.TypeString,
197-
ValidateDiagFunc: verify.IsUUIDorUUIDWithLocality(),
198-
DiffSuppressFunc: dsf.Locality,
199-
},
193+
"filesystems": {
194+
Type: schema.TypeList,
200195
Optional: true,
201-
Description: "The filesystem IDs attached to the server",
196+
Computed: true,
197+
Description: "Filesystems attach to the server",
198+
Elem: &schema.Resource{
199+
Schema: map[string]*schema.Schema{
200+
"filesystem_id": {
201+
Type: schema.TypeString,
202+
Optional: true,
203+
Computed: true,
204+
Description: "The filesystem ID attached to the server",
205+
},
206+
"status": {
207+
Type: schema.TypeString,
208+
Computed: true,
209+
Description: "The state of the filesystem",
210+
},
211+
},
212+
},
202213
},
203214
"enable_ipv6": {
204215
Type: schema.TypeBool,
@@ -529,13 +540,17 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m
529540
///
530541
// Attach Filesystem
531542
///
532-
if filesystem, ok := d.GetOk("filesystem_ids"); ok {
533-
for _, filesystemID := range filesystem.([]interface{}) {
543+
_, err = waitForServer(ctx, api.API, zone, res.Server.ID, d.Timeout(schema.TimeoutCreate))
544+
if filesystems, ok := d.GetOk("filesystems"); ok {
545+
for _, filesystem := range filesystems.([]interface{}) {
546+
fs := filesystem.(map[string]interface{})
547+
filesystemID := fs["filesystem_id"]
534548
_, err := api.AttachServerFileSystem(&instanceSDK.AttachServerFileSystemRequest{
535549
Zone: zone,
536550
FilesystemID: filesystemID.(string),
537551
ServerID: res.Server.ID,
538552
})
553+
539554
if err != nil {
540555
return nil
541556
}

0 commit comments

Comments
 (0)