diff --git a/.changelog/25230.txt b/.changelog/25230.txt new file mode 100644 index 00000000000..081bdd4b32e --- /dev/null +++ b/.changelog/25230.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_keyspaces_table: Relax validation of the `schema_definition.column.type` argument to allow collection types +``` \ No newline at end of file diff --git a/internal/service/keyspaces/table.go b/internal/service/keyspaces/table.go index ca5d5785744..99c4a477ad5 100644 --- a/internal/service/keyspaces/table.go +++ b/internal/service/keyspaces/table.go @@ -210,8 +210,8 @@ func ResourceTable() *schema.Resource { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^[a-z0-9]+$`), - "The type must consist of lower case alphanumerics.", + regexp.MustCompile(`^[a-z0-9]+(\<[a-z0-9]+(, *[a-z0-9]+){0,1}\>)?$`), + "The type must consist of lower case alphanumerics and an optional list of upto two lower case alphanumerics enclosed in angle brackets '<>'.", ), }, }, diff --git a/internal/service/keyspaces/table_test.go b/internal/service/keyspaces/table_test.go index 2ef388fc5d5..7f86a2e67ea 100644 --- a/internal/service/keyspaces/table_test.go +++ b/internal/service/keyspaces/table_test.go @@ -166,7 +166,7 @@ func TestAccKeyspacesTable_multipleColumns(t *testing.T) { "name": "region", "order_by": "DESC", }), - resource.TestCheckResourceAttr(resourceName, "schema_definition.0.column.#", "9"), + resource.TestCheckResourceAttr(resourceName, "schema_definition.0.column.#", "11"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.column.*", map[string]string{ "name": "id", "type": "text", @@ -203,6 +203,14 @@ func TestAccKeyspacesTable_multipleColumns(t *testing.T) { "name": "manager_id", "type": "text", }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.column.*", map[string]string{ + "name": "nicknames", + "type": "list", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.column.*", map[string]string{ + "name": "tags", + "type": "map", + }), resource.TestCheckResourceAttr(resourceName, "schema_definition.0.partition_key.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.partition_key.*", map[string]string{ "name": "id", @@ -648,6 +656,16 @@ resource "aws_keyspaces_table" "test" { type = "text" } + column { + name = "nicknames" + type = "list" + } + + column { + name = "tags" + type = "map" + } + partition_key { name = "id" }