diff --git a/proxmoxtf/provider/provider_test.go b/proxmoxtf/provider/provider_test.go index eb04f6ec..cf897d64 100644 --- a/proxmoxtf/provider/provider_test.go +++ b/proxmoxtf/provider/provider_test.go @@ -58,6 +58,7 @@ func TestProviderSchema(t *testing.T) { mkProviderOTP, mkProviderPassword, mkProviderUsername, + mkProviderSSH, }) test.AssertValueTypes(t, veSchema, map[string]schema.ValueType{ @@ -66,5 +67,11 @@ func TestProviderSchema(t *testing.T) { mkProviderOTP: schema.TypeString, mkProviderPassword: schema.TypeString, mkProviderUsername: schema.TypeString, + mkProviderSSH: schema.TypeList, }) + + providerSSHSchema := test.AssertNestedSchemaExistence(t, s, mkProviderSSH) + + // do not limit number of nodes in the cluster + test.AssertListMaxItems(t, providerSSHSchema, mkProviderSSHNode, 0) } diff --git a/proxmoxtf/provider/schema.go b/proxmoxtf/provider/schema.go index 482dca60..0e19e75a 100644 --- a/proxmoxtf/provider/schema.go +++ b/proxmoxtf/provider/schema.go @@ -197,7 +197,6 @@ func nestedProviderSchema() map[string]*schema.Schema { Type: schema.TypeList, Optional: true, MinItems: 0, - MaxItems: 1, Description: "Overrides for SSH connection configuration to a Proxmox node", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/proxmoxtf/test/test_utils.go b/proxmoxtf/test/test_utils.go index 81de76e0..9d1b2961 100644 --- a/proxmoxtf/test/test_utils.go +++ b/proxmoxtf/test/test_utils.go @@ -39,6 +39,16 @@ func AssertNestedSchemaExistence(t *testing.T, s *schema.Resource, key string) * return sh } +// AssertListMaxItems checks that the given schema attribute has given expected MaxItems value. +func AssertListMaxItems(t *testing.T, s *schema.Resource, key string, expectedMaxItems int) { + t.Helper() + + require.NotNil(t, s.Schema[key], "Error in Schema: Missing definition for \"%s\"", key) + assert.Equal(t, s.Schema[key].MaxItems, expectedMaxItems, + "Error in Schema: Argument \"%s\" has \"MaxItems: %#v\", but value %#v is expected!", + key, s.Schema[key].MaxItems, expectedMaxItems) +} + // AssertOptionalArguments checks that the given schema has the given optional arguments. func AssertOptionalArguments(t *testing.T, s *schema.Resource, keys []string) { t.Helper()