Skip to content

Commit

Permalink
Merge pull request #26812 from michaelraney/main
Browse files Browse the repository at this point in the history
Fix PartitionKey and ClusteringKey Types in Schema
  • Loading branch information
ewbankkit authored Sep 30, 2022
2 parents 562f79f + 2633087 commit 2c07d5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changelog/26812.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_keyspaces_table: Change `schema_definition.clustering_key` and `schema_definition.partition_key` to lists in order to respect configured orderings
```
16 changes: 8 additions & 8 deletions internal/service/keyspaces/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func ResourceTable() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"clustering_key": {
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -218,7 +218,7 @@ func ResourceTable() *schema.Resource {
},
},
"partition_key": {
Type: schema.TypeSet,
Type: schema.TypeList,
Required: true,
ForceNew: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -802,16 +802,16 @@ func expandSchemaDefinition(tfMap map[string]interface{}) *keyspaces.SchemaDefin

apiObject := &keyspaces.SchemaDefinition{}

if v, ok := tfMap["column"].(*schema.Set); ok && v.Len() > 0 {
apiObject.AllColumns = expandColumnDefinitions(v.List())
if v, ok := tfMap["clustering_key"].([]interface{}); ok && len(v) > 0 {
apiObject.ClusteringKeys = expandClusteringKeys(v)
}

if v, ok := tfMap["clustering_key"].(*schema.Set); ok && v.Len() > 0 {
apiObject.ClusteringKeys = expandClusteringKeys(v.List())
if v, ok := tfMap["column"].(*schema.Set); ok && v.Len() > 0 {
apiObject.AllColumns = expandColumnDefinitions(v.List())
}

if v, ok := tfMap["partition_key"].(*schema.Set); ok && v.Len() > 0 {
apiObject.PartitionKeys = expandPartitionKeys(v.List())
if v, ok := tfMap["partition_key"].([]interface{}); ok && len(v) > 0 {
apiObject.PartitionKeys = expandPartitionKeys(v)
}

if v, ok := tfMap["static_column"].(*schema.Set); ok && v.Len() > 0 {
Expand Down

0 comments on commit 2c07d5c

Please sign in to comment.