Handle nameservers as optional field in network (#521)
* make nameservers optional * fix typo in unit test * update docs * Add UseStateForUnkown --------- Co-authored-by: Vicente Pinto <vicente.pinto@freiheit.com>
This commit is contained in:
parent
aba728487f
commit
4de8552303
3 changed files with 8 additions and 3 deletions
|
|
@ -27,12 +27,12 @@ resource "stackit_network" "example" {
|
||||||
### Required
|
### Required
|
||||||
|
|
||||||
- `name` (String) The name of the network.
|
- `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.
|
- `project_id` (String) STACKIT project ID to which the network is associated.
|
||||||
|
|
||||||
### Optional
|
### Optional
|
||||||
|
|
||||||
- `ipv4_prefix_length` (Number) The IPv4 prefix length of the network.
|
- `ipv4_prefix_length` (Number) The IPv4 prefix length of the network.
|
||||||
|
- `nameservers` (List of String) The nameservers of the network.
|
||||||
|
|
||||||
### Read-Only
|
### Read-Only
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"github.com/hashicorp/terraform-plugin-framework/path"
|
"github.com/hashicorp/terraform-plugin-framework/path"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource"
|
"github.com/hashicorp/terraform-plugin-framework/resource"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
"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/planmodifier"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||||
|
|
@ -139,7 +140,11 @@ func (r *networkResource) Schema(_ context.Context, _ resource.SchemaRequest, re
|
||||||
},
|
},
|
||||||
"nameservers": schema.ListAttribute{
|
"nameservers": schema.ListAttribute{
|
||||||
Description: "The nameservers of the network.",
|
Description: "The nameservers of the network.",
|
||||||
Required: true,
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
PlanModifiers: []planmodifier.List{
|
||||||
|
listplanmodifier.UseStateForUnknown(),
|
||||||
|
},
|
||||||
ElementType: types.StringType,
|
ElementType: types.StringType,
|
||||||
},
|
},
|
||||||
"ipv4_prefix_length": schema.Int64Attribute{
|
"ipv4_prefix_length": schema.Int64Attribute{
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func TestMapFields(t *testing.T) {
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nameservers_changed_outisde_tf",
|
"nameservers_changed_outside_tf",
|
||||||
Model{
|
Model{
|
||||||
ProjectId: types.StringValue("pid"),
|
ProjectId: types.StringValue("pid"),
|
||||||
NetworkId: types.StringValue("nid"),
|
NetworkId: types.StringValue("nid"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue