Skip to content

Commit

Permalink
Merge pull request #25230 from uchanchlani/issue-25229
Browse files Browse the repository at this point in the history
Fix aws_keyspaces_table collection data types
  • Loading branch information
ewbankkit authored Jun 22, 2022
2 parents 0556ad2 + 738667d commit 64daad7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/25230.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_keyspaces_table: Relax validation of the `schema_definition.column.type` argument to allow collection types
```
4 changes: 2 additions & 2 deletions internal/service/keyspaces/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<>'.",
),
},
},
Expand Down
20 changes: 19 additions & 1 deletion internal/service/keyspaces/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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<text>",
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.column.*", map[string]string{
"name": "tags",
"type": "map<text, text>",
}),
resource.TestCheckResourceAttr(resourceName, "schema_definition.0.partition_key.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.partition_key.*", map[string]string{
"name": "id",
Expand Down Expand Up @@ -648,6 +656,16 @@ resource "aws_keyspaces_table" "test" {
type = "text"
}
column {
name = "nicknames"
type = "list<text>"
}
column {
name = "tags"
type = "map<text, text>"
}
partition_key {
name = "id"
}
Expand Down

0 comments on commit 64daad7

Please sign in to comment.