Skip to content

Commit

Permalink
Manage glesys_networkadapter Name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
norrland committed Sep 11, 2024
1 parent 134235f commit 1e84181
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/resources/networkadapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ resource "glesys_networkadapter" "example" {

- `adaptertype` (String) `VMXNET 3` (default) or `E1000`
- `bandwidth` (Number) adapter bandwidth
- `name` (String) Network Adapter name
- `networkid` (String) Network ID to connect to. Defaults to `internet`.

### Read-Only

- `id` (String) The ID of this resource.
- `name` (String) Network Adapter name
## Import
Import is supported using the following syntax:
```shell
Expand Down
5 changes: 5 additions & 0 deletions glesys/resource_glesys_networkadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func resourceGlesysNetworkAdapter() *schema.Resource {
Description: "Network Adapter name",
Type: schema.TypeString,
Computed: true,
Optional: true,
},
"networkid": {
Description: "Network ID to connect to. Defaults to `internet`.",
Expand All @@ -59,6 +60,7 @@ func resourceGlesysNetworkAdapterCreate(ctx context.Context, d *schema.ResourceD
params := glesys.CreateNetworkAdapterParams{
AdapterType: d.Get("adaptertype").(string),
Bandwidth: d.Get("bandwidth").(int),
Name: d.Get("name").(string),
NetworkID: d.Get("networkid").(string),
ServerID: d.Get("serverid").(string),
}
Expand Down Expand Up @@ -102,6 +104,9 @@ func resourceGlesysNetworkAdapterUpdate(ctx context.Context, d *schema.ResourceD
if d.HasChange("bandwidth") {
params.Bandwidth = d.Get("bandwidth").(int)
}
if d.HasChange("name") {
params.Name = d.Get("name").(string)
}
if d.HasChange("networkid") {
params.NetworkID = d.Get("networkid").(string)
}
Expand Down

0 comments on commit 1e84181

Please sign in to comment.