diff --git a/docs/resources/network.md b/docs/resources/network.md index 9b967776..3032f50c 100644 --- a/docs/resources/network.md +++ b/docs/resources/network.md @@ -27,12 +27,12 @@ resource "stackit_network" "example" { ### Required - `name` (String) The name of the network. -- `nameservers` (List of String) The nameservers of the network. - `project_id` (String) STACKIT project ID to which the network is associated. ### Optional - `ipv4_prefix_length` (Number) The IPv4 prefix length of the network. +- `nameservers` (List of String) The nameservers of the network. ### Read-Only diff --git a/stackit/internal/services/iaas/network/resource.go b/stackit/internal/services/iaas/network/resource.go index 3aa02bdb..f9a97762 100644 --- a/stackit/internal/services/iaas/network/resource.go +++ b/stackit/internal/services/iaas/network/resource.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" @@ -139,7 +140,11 @@ func (r *networkResource) Schema(_ context.Context, _ resource.SchemaRequest, re }, "nameservers": schema.ListAttribute{ Description: "The nameservers of the network.", - Required: true, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.List{ + listplanmodifier.UseStateForUnknown(), + }, ElementType: types.StringType, }, "ipv4_prefix_length": schema.Int64Attribute{ diff --git a/stackit/internal/services/iaas/network/resource_test.go b/stackit/internal/services/iaas/network/resource_test.go index ee648ab1..945ff185 100644 --- a/stackit/internal/services/iaas/network/resource_test.go +++ b/stackit/internal/services/iaas/network/resource_test.go @@ -78,7 +78,7 @@ func TestMapFields(t *testing.T) { true, }, { - "nameservers_changed_outisde_tf", + "nameservers_changed_outside_tf", Model{ ProjectId: types.StringValue("pid"), NetworkId: types.StringValue("nid"),