diff --git a/fwprovider/cluster/sdn/zone/resource_generic.go b/fwprovider/cluster/sdn/zone/resource_generic.go index 3c4e9005..94efe910 100644 --- a/fwprovider/cluster/sdn/zone/resource_generic.go +++ b/fwprovider/cluster/sdn/zone/resource_generic.go @@ -68,16 +68,9 @@ func (m *genericModel) getID() string { return m.ID.ValueString() } -func genericAttributesWith(extraAttributes ...map[string]schema.Attribute) map[string]schema.Attribute { - if len(extraAttributes) > 1 { - panic("genericAttributesWith expects at most one extraAttributes map") - } - - if len(extraAttributes) == 0 { - extraAttributes = append(extraAttributes, make(map[string]schema.Attribute)) - } - - maps.Copy(extraAttributes[0], map[string]schema.Attribute{ +func genericAttributesWith(extraAttributes map[string]schema.Attribute) map[string]schema.Attribute { + // Start with generic attributes as the base + result := map[string]schema.Attribute{ "dns": schema.StringAttribute{ Optional: true, Description: "DNS API server address.", @@ -116,9 +109,14 @@ func genericAttributesWith(extraAttributes ...map[string]schema.Attribute) map[s Optional: true, Description: "Reverse DNS API server address.", }, - }) + } - return extraAttributes[0] + // Add extra attributes, allowing them to override generic ones if needed + if extraAttributes != nil { + maps.Copy(result, extraAttributes) + } + + return result } type zoneModel interface { diff --git a/fwprovider/cluster/sdn/zone/resource_simple.go b/fwprovider/cluster/sdn/zone/resource_simple.go index d8de0ae5..71866b7d 100644 --- a/fwprovider/cluster/sdn/zone/resource_simple.go +++ b/fwprovider/cluster/sdn/zone/resource_simple.go @@ -44,7 +44,7 @@ func (r *SimpleResource) Schema(_ context.Context, _ resource.SchemaRequest, res MarkdownDescription: "Simple Zone in Proxmox SDN. It will create an isolated VNet bridge. " + "This bridge is not linked to a physical interface, and VM traffic is only local on each the node. " + "It can be used in NAT or routed setups.", - Attributes: genericAttributesWith(), + Attributes: genericAttributesWith(nil), } }