Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aws_keyspaces_table collection data types #25230

Merged
merged 5 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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