feature: Add "network_interfaces" field to server resource (#628)

* Add network_interfaces field to server resource

* Update docs

* Update description of stackit_server_network_interface_attach

Co-authored-by: João Palet <joao.palet@outlook.com>

---------

Co-authored-by: João Palet <joao.palet@outlook.com>
This commit is contained in:
Marcel Jacek 2025-01-22 11:22:39 +01:00 committed by GitHub
parent 9b969ae583
commit 4d6f860b26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 132 additions and 49 deletions

View file

@ -151,6 +151,11 @@ func (r *serverDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
Description: "The image ID to be used for an ephemeral disk on the server.",
Computed: true,
},
"network_interfaces": schema.ListAttribute{
Description: "The IDs of network interfaces which should be attached to the server. Updating it will recreate the server.",
Computed: true,
ElementType: types.StringType,
},
"keypair_name": schema.StringAttribute{
Description: "The name of the keypair used during server creation.",
Computed: true,
@ -201,7 +206,9 @@ func (r *serverDataSource) Read(ctx context.Context, req datasource.ReadRequest,
ctx = tflog.SetField(ctx, "project_id", projectId)
ctx = tflog.SetField(ctx, "server_id", serverId)
serverResp, err := r.client.GetServer(ctx, projectId, serverId).Execute()
serverReq := r.client.GetServer(ctx, projectId, serverId)
serverReq = serverReq.Details(true)
serverResp, err := serverReq.Execute()
if err != nil {
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
if ok && oapiErr.StatusCode == http.StatusNotFound {