From ca2993c540ae64e854b1b4193a157a31063ec7e2 Mon Sep 17 00:00:00 2001 From: keerthsx Date: Mon, 11 Mar 2024 22:59:03 -0400 Subject: [PATCH 1/9] Added support for Replication Specification while creating AWS keyspaces --- internal/service/keyspaces/keyspace.go | 28 ++++++++++ internal/service/keyspaces/keyspace_test.go | 60 +++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/internal/service/keyspaces/keyspace.go b/internal/service/keyspaces/keyspace.go index cd22de67b63..37b9c1785f9 100644 --- a/internal/service/keyspaces/keyspace.go +++ b/internal/service/keyspaces/keyspace.go @@ -59,6 +59,26 @@ func resourceKeyspace() *schema.Resource { "The name can have up to 48 characters. It must begin with an alpha-numeric character and can only contain alpha-numeric characters and underscores.", ), }, + "replication_specification": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region_list": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "replication_strategy": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(types.RsSingleRegion), + string(types.RsMultiRegion)}, false), + }, + }, + }, + }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), }, @@ -76,6 +96,14 @@ func resourceKeyspaceCreate(ctx context.Context, d *schema.ResourceData, meta in Tags: getTagsIn(ctx), } + if v, ok := d.GetOk("replication_specification"); ok { + replicationSpecification := v.([]interface{})[0].(map[string]interface{}) + input.ReplicationSpecification = &types.ReplicationSpecification{ + RegionList: replicationSpecification["region_list"].([]string), + ReplicationStrategy: types.Rs(replicationSpecification["replication_strategy"].(string)), + } + } + _, err := conn.CreateKeyspace(ctx, input) if err != nil { diff --git a/internal/service/keyspaces/keyspace_test.go b/internal/service/keyspaces/keyspace_test.go index 741670a63ad..5ecf340a72e 100644 --- a/internal/service/keyspaces/keyspace_test.go +++ b/internal/service/keyspaces/keyspace_test.go @@ -8,6 +8,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go-v2/service/keyspaces/types" "github.com/aws/aws-sdk-go/aws/endpoints" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -52,6 +53,42 @@ func TestAccKeyspacesKeyspace_basic(t *testing.T) { }) } +func TestAccKeyspacesKeyspace_replicationSpecification(t *testing.T) { + ctx := acctest.Context(t) + rName := "tf_acc_test_" + sdkacctest.RandString(20) + resourceName := "aws_keyspaces_keyspace.test" + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, names.KeyspacesServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckKeyspaceDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccKeyspaceConfig_replicationSpecification(rName, string(types.RsSingleRegion)), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckKeyspaceExists(ctx, resourceName), + acctest.CheckResourceAttrRegionalARN(resourceName, "arn", "cassandra", "/keyspace/"+rName+"/"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "replication_specification.0.replication_strategy", string(types.RsMultiRegion)), + resource.TestCheckResourceAttr(resourceName, "replication_specification.0.region_list.#", "0"), + ), + }, + { + Config: testAccKeyspaceConfig_multiReplicationSpecification(rName, string(types.RsMultiRegion), string("[\"us-east-1\", \"us-west-2\"]")), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckKeyspaceExists(ctx, resourceName), + acctest.CheckResourceAttrRegionalARN(resourceName, "arn", "cassandra", "/keyspace/"+rName+"/"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "replication_specification.0.replication_strategy", string(types.RsMultiRegion)), + resource.TestCheckResourceAttr(resourceName, "replication_specification.0.region_list.#", "2"), + ), + }, + }, + }) +} + func TestAccKeyspacesKeyspace_disappears(t *testing.T) { ctx := acctest.Context(t) rName := "tf_acc_test_" + sdkacctest.RandString(20) @@ -197,3 +234,26 @@ resource "aws_keyspaces_keyspace" "test" { } `, rName, tag1Key, tag1Value, tag2Key, tag2Value) } + +func testAccKeyspaceConfig_replicationSpecification(rName, rSpecification string) string { + return fmt.Sprintf(` +resource "aws_keyspaces_keyspace" "test" { + name = %[1]q + ReplicationSpecification { + ReplicationStrategy = %[2]q + } +} +`, rName, rSpecification) +} + +func testAccKeyspaceConfig_multiReplicationSpecification(rName, rSpecification, regionList string) string { + return fmt.Sprintf(` +resource "aws_keyspaces_keyspace" "test" { + name = %[1]q + ReplicationSpecification { + ReplicationStrategy = %[2]q + RegionList = %[3]q + } +} +`, rName, rSpecification, regionList) +} From f71d50caa3da044d9067aee4043cb938c504888b Mon Sep 17 00:00:00 2001 From: keerthsx Date: Mon, 11 Mar 2024 23:57:04 -0400 Subject: [PATCH 2/9] Updates based on the tests --- internal/service/keyspaces/keyspace.go | 10 +++++----- internal/service/keyspaces/keyspace_test.go | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/internal/service/keyspaces/keyspace.go b/internal/service/keyspaces/keyspace.go index 37b9c1785f9..9e47fc4bf57 100644 --- a/internal/service/keyspaces/keyspace.go +++ b/internal/service/keyspaces/keyspace.go @@ -64,11 +64,6 @@ func resourceKeyspace() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "region_list": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, "replication_strategy": { Type: schema.TypeString, Required: true, @@ -76,6 +71,11 @@ func resourceKeyspace() *schema.Resource { string(types.RsSingleRegion), string(types.RsMultiRegion)}, false), }, + "region_list": { + Type: schema.TypeList, + Required: false, + Elem: &schema.Schema{Type: schema.TypeString}, + }, }, }, }, diff --git a/internal/service/keyspaces/keyspace_test.go b/internal/service/keyspaces/keyspace_test.go index 5ecf340a72e..3c2cfd5efcc 100644 --- a/internal/service/keyspaces/keyspace_test.go +++ b/internal/service/keyspaces/keyspace_test.go @@ -57,8 +57,9 @@ func TestAccKeyspacesKeyspace_replicationSpecification(t *testing.T) { ctx := acctest.Context(t) rName := "tf_acc_test_" + sdkacctest.RandString(20) resourceName := "aws_keyspaces_keyspace.test" + resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, names.KeyspacesServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckKeyspaceDestroy(ctx), @@ -239,8 +240,8 @@ func testAccKeyspaceConfig_replicationSpecification(rName, rSpecification string return fmt.Sprintf(` resource "aws_keyspaces_keyspace" "test" { name = %[1]q - ReplicationSpecification { - ReplicationStrategy = %[2]q + replication_specification { + replication_strategy = %[2]q } } `, rName, rSpecification) @@ -250,9 +251,9 @@ func testAccKeyspaceConfig_multiReplicationSpecification(rName, rSpecification, return fmt.Sprintf(` resource "aws_keyspaces_keyspace" "test" { name = %[1]q - ReplicationSpecification { - ReplicationStrategy = %[2]q - RegionList = %[3]q + replication_specification { + replication_strategy = %[2]q + region_list = %[3]q } } `, rName, rSpecification, regionList) From 3a54d8cbed51b400ead04ba3028332da96cd54d2 Mon Sep 17 00:00:00 2001 From: keerthsx Date: Tue, 12 Mar 2024 03:10:14 -0400 Subject: [PATCH 3/9] Use region_list only if the replication strategy is multi-region --- internal/service/keyspaces/keyspace.go | 22 ++++++++++++++++----- internal/service/keyspaces/keyspace_test.go | 15 +++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/internal/service/keyspaces/keyspace.go b/internal/service/keyspaces/keyspace.go index 9e47fc4bf57..c6405175792 100644 --- a/internal/service/keyspaces/keyspace.go +++ b/internal/service/keyspaces/keyspace.go @@ -66,14 +66,14 @@ func resourceKeyspace() *schema.Resource { Schema: map[string]*schema.Schema{ "replication_strategy": { Type: schema.TypeString, - Required: true, + Optional: true, ValidateFunc: validation.StringInSlice([]string{ string(types.RsSingleRegion), string(types.RsMultiRegion)}, false), }, "region_list": { Type: schema.TypeList, - Required: false, + Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, }, @@ -98,9 +98,12 @@ func resourceKeyspaceCreate(ctx context.Context, d *schema.ResourceData, meta in if v, ok := d.GetOk("replication_specification"); ok { replicationSpecification := v.([]interface{})[0].(map[string]interface{}) - input.ReplicationSpecification = &types.ReplicationSpecification{ - RegionList: replicationSpecification["region_list"].([]string), - ReplicationStrategy: types.Rs(replicationSpecification["replication_strategy"].(string)), + replicationStrategy := replicationSpecification["replication_strategy"].(string) + if replicationStrategy == string(types.RsMultiRegion) { + input.ReplicationSpecification = &types.ReplicationSpecification{ + ReplicationStrategy: types.Rs(replicationStrategy), + RegionList: listToStringSlice(replicationSpecification["region_list"].([]interface{})), + } } } @@ -208,3 +211,12 @@ func findKeyspaceByName(ctx context.Context, conn *keyspaces.Client, name string return output, nil } + +// converts a interface of regions to a string slice +func listToStringSlice(regions []interface{}) []string { + result := make([]string, len(regions)) + for i, region := range regions { + result[i] = region.(string) + } + return result +} diff --git a/internal/service/keyspaces/keyspace_test.go b/internal/service/keyspaces/keyspace_test.go index 3c2cfd5efcc..1a8b6938938 100644 --- a/internal/service/keyspaces/keyspace_test.go +++ b/internal/service/keyspaces/keyspace_test.go @@ -53,10 +53,12 @@ func TestAccKeyspacesKeyspace_basic(t *testing.T) { }) } -func TestAccKeyspacesKeyspace_replicationSpecification(t *testing.T) { +func TestAccKeyspacesKeyspace_replicationSpecificationMulti(t *testing.T) { ctx := acctest.Context(t) rName := "tf_acc_test_" + sdkacctest.RandString(20) resourceName := "aws_keyspaces_keyspace.test" + region1 := acctest.Region() + region2 := acctest.AlternateRegion() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(t) }, @@ -71,12 +73,11 @@ func TestAccKeyspacesKeyspace_replicationSpecification(t *testing.T) { acctest.CheckResourceAttrRegionalARN(resourceName, "arn", "cassandra", "/keyspace/"+rName+"/"), resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "replication_specification.0.replication_strategy", string(types.RsMultiRegion)), - resource.TestCheckResourceAttr(resourceName, "replication_specification.0.region_list.#", "0"), + resource.TestCheckResourceAttr(resourceName, "replication_specification.0.replication_strategy", string(types.RsSingleRegion)), ), }, { - Config: testAccKeyspaceConfig_multiReplicationSpecification(rName, string(types.RsMultiRegion), string("[\"us-east-1\", \"us-west-2\"]")), + Config: testAccKeyspaceConfig_multiReplicationSpecification(rName, string(types.RsMultiRegion), region1, region2), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckKeyspaceExists(ctx, resourceName), acctest.CheckResourceAttrRegionalARN(resourceName, "arn", "cassandra", "/keyspace/"+rName+"/"), @@ -247,14 +248,14 @@ resource "aws_keyspaces_keyspace" "test" { `, rName, rSpecification) } -func testAccKeyspaceConfig_multiReplicationSpecification(rName, rSpecification, regionList string) string { +func testAccKeyspaceConfig_multiReplicationSpecification(rName, rSpecification, region1, region2 string) string { return fmt.Sprintf(` resource "aws_keyspaces_keyspace" "test" { name = %[1]q replication_specification { replication_strategy = %[2]q - region_list = %[3]q + region_list = [%[3]q, %[4]q] } } -`, rName, rSpecification, regionList) +`, rName, rSpecification, region1, region2) } From d088571e9efd0527058950007c1f905c13c447b6 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 16:04:55 -0400 Subject: [PATCH 4/9] Add CHANGELOG entry. --- .changelog/36331.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/36331.txt diff --git a/.changelog/36331.txt b/.changelog/36331.txt new file mode 100644 index 00000000000..7ea756883d8 --- /dev/null +++ b/.changelog/36331.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_keyspaces_keyspace: Add `replication_specification` argument +``` \ No newline at end of file From 10029f47344e11c3635f1e478d07e94de3df4a29 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 16:05:08 -0400 Subject: [PATCH 5/9] Add documentation. --- website/docs/r/keyspaces_keyspace.html.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/docs/r/keyspaces_keyspace.html.markdown b/website/docs/r/keyspaces_keyspace.html.markdown index 50eb56b9da5..85953ce1c97 100644 --- a/website/docs/r/keyspaces_keyspace.html.markdown +++ b/website/docs/r/keyspaces_keyspace.html.markdown @@ -28,6 +28,9 @@ The following arguments are required: The following arguments are optional: +* `replication_specification` - (Optional) The replication specification of the keyspace. + * `region_list` - (Optional) Replication regions. If `replication_strategy` is `MULTI_REGION`, `region_list` requires the current Region and at least one additional AWS Region where the keyspace is going to be replicated in. + * `replication_strategy` - (Required) Replication strategy. Valid values: `SINGLE_REGION` and `MULTI_REGION`. * `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attribute Reference From d210477dfd9e9a667e4d9a3873ecaa262b1fff40 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 16:10:25 -0400 Subject: [PATCH 6/9] r/aws_keyspaces_keyspace: 'replication_specification' is Optional+Computed+ForceNew. --- internal/service/keyspaces/keyspace.go | 56 +++++++++++++------------- internal/service/keyspaces/table.go | 7 ---- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/internal/service/keyspaces/keyspace.go b/internal/service/keyspaces/keyspace.go index 4f22489ff3d..722d3105a08 100644 --- a/internal/service/keyspaces/keyspace.go +++ b/internal/service/keyspaces/keyspace.go @@ -17,8 +17,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/internal/flex" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" @@ -62,19 +64,27 @@ func resourceKeyspace() *schema.Resource { "replication_specification": { Type: schema.TypeList, Optional: true, + Computed: true, + ForceNew: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "replication_strategy": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(types.RsSingleRegion), - string(types.RsMultiRegion)}, false), + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateDiagFunc: enum.Validate[types.Rs](), }, "region_list": { - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + ForceNew: true, + MaxItems: 6, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: verify.ValidRegionName, + }, }, }, }, @@ -87,7 +97,6 @@ func resourceKeyspace() *schema.Resource { func resourceKeyspaceCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) name := d.Get(names.AttrName).(string) @@ -96,14 +105,14 @@ func resourceKeyspaceCreate(ctx context.Context, d *schema.ResourceData, meta in Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("replication_specification"); ok { - replicationSpecification := v.([]interface{})[0].(map[string]interface{}) - replicationStrategy := replicationSpecification["replication_strategy"].(string) - if replicationStrategy == string(types.RsMultiRegion) { - input.ReplicationSpecification = &types.ReplicationSpecification{ - ReplicationStrategy: types.Rs(replicationStrategy), - RegionList: listToStringSlice(replicationSpecification["region_list"].([]interface{})), - } + if v, ok := d.GetOk("replication_specification"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + tfMap := v.([]interface{})[0].(map[string]interface{}) + input.ReplicationSpecification = &types.ReplicationSpecification{ + ReplicationStrategy: types.Rs(tfMap["replication_strategy"].(string)), + } + + if v, ok := tfMap["region_list"].(*schema.Set); ok && v.Len() > 0 { + input.ReplicationSpecification.RegionList = flex.ExpandStringValueSet(v) } } @@ -128,7 +137,6 @@ func resourceKeyspaceCreate(ctx context.Context, d *schema.ResourceData, meta in func resourceKeyspaceRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) keyspace, err := findKeyspaceByName(ctx, conn, d.Id()) @@ -145,6 +153,10 @@ func resourceKeyspaceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrARN, keyspace.ResourceArn) d.Set(names.AttrName, keyspace.KeyspaceName) + d.Set("replication_specification", []interface{}{map[string]interface{}{ + "region_list": keyspace.ReplicationRegions, + "replication_strategy": keyspace.ReplicationStrategy, + }}) return diags } @@ -156,7 +168,6 @@ func resourceKeyspaceUpdate(ctx context.Context, d *schema.ResourceData, meta in func resourceKeyspaceDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) log.Printf("[DEBUG] Deleting Keyspaces Keyspace: (%s)", d.Id()) @@ -211,12 +222,3 @@ func findKeyspaceByName(ctx context.Context, conn *keyspaces.Client, name string return output, nil } - -// converts a interface of regions to a string slice -func listToStringSlice(regions []interface{}) []string { - result := make([]string, len(regions)) - for i, region := range regions { - result[i] = region.(string) - } - return result -} diff --git a/internal/service/keyspaces/table.go b/internal/service/keyspaces/table.go index d80e3ff4871..4f7463d8954 100644 --- a/internal/service/keyspaces/table.go +++ b/internal/service/keyspaces/table.go @@ -305,7 +305,6 @@ func resourceTable() *schema.Resource { func resourceTableCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) keyspaceName := d.Get("keyspace_name").(string) @@ -366,11 +365,9 @@ func resourceTableCreate(ctx context.Context, d *schema.ResourceData, meta inter func resourceTableRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) keyspaceName, tableName, err := tableParseResourceID(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -446,11 +443,9 @@ func resourceTableRead(ctx context.Context, d *schema.ResourceData, meta interfa func resourceTableUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) keyspaceName, tableName, err := tableParseResourceID(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -618,11 +613,9 @@ func resourceTableUpdate(ctx context.Context, d *schema.ResourceData, meta inter func resourceTableDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) keyspaceName, tableName, err := tableParseResourceID(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } From e8fdc02aa2b1f671ff85a159ae0462a9a77100cc Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 16:15:01 -0400 Subject: [PATCH 7/9] Fix markdown-lint 'MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]'. --- website/docs/r/keyspaces_keyspace.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/keyspaces_keyspace.html.markdown b/website/docs/r/keyspaces_keyspace.html.markdown index 85953ce1c97..6ee3399a733 100644 --- a/website/docs/r/keyspaces_keyspace.html.markdown +++ b/website/docs/r/keyspaces_keyspace.html.markdown @@ -29,7 +29,7 @@ The following arguments are required: The following arguments are optional: * `replication_specification` - (Optional) The replication specification of the keyspace. - * `region_list` - (Optional) Replication regions. If `replication_strategy` is `MULTI_REGION`, `region_list` requires the current Region and at least one additional AWS Region where the keyspace is going to be replicated in. + * `region_list` - (Optional) Replication regions. If `replication_strategy` is `MULTI_REGION`, `region_list` requires the current Region and at least one additional AWS Region where the keyspace is going to be replicated in. * `replication_strategy` - (Required) Replication strategy. Valid values: `SINGLE_REGION` and `MULTI_REGION`. * `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. From ebc7db95581927a889fbaff2bc9810fa4ee72a90 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 16:15:15 -0400 Subject: [PATCH 8/9] Fix terrafmt errors. --- internal/service/keyspaces/keyspace_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/service/keyspaces/keyspace_test.go b/internal/service/keyspaces/keyspace_test.go index 2daf50b8564..408c069e23c 100644 --- a/internal/service/keyspaces/keyspace_test.go +++ b/internal/service/keyspaces/keyspace_test.go @@ -241,8 +241,9 @@ func testAccKeyspaceConfig_replicationSpecification(rName, rSpecification string return fmt.Sprintf(` resource "aws_keyspaces_keyspace" "test" { name = %[1]q + replication_specification { - replication_strategy = %[2]q + replication_strategy = %[2]q } } `, rName, rSpecification) @@ -252,9 +253,10 @@ func testAccKeyspaceConfig_multiReplicationSpecification(rName, rSpecification, return fmt.Sprintf(` resource "aws_keyspaces_keyspace" "test" { name = %[1]q + replication_specification { - replication_strategy = %[2]q - region_list = [%[3]q, %[4]q] + replication_strategy = %[2]q + region_list = [%[3]q, %[4]q] } } `, rName, rSpecification, region1, region2) From a4c9d033c610a200dc03507755fe68a37b930f4c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 16:18:55 -0400 Subject: [PATCH 9/9] Fix terrafmt error. --- internal/service/keyspaces/keyspace_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/keyspaces/keyspace_test.go b/internal/service/keyspaces/keyspace_test.go index 408c069e23c..3ad4f54626f 100644 --- a/internal/service/keyspaces/keyspace_test.go +++ b/internal/service/keyspaces/keyspace_test.go @@ -242,7 +242,7 @@ func testAccKeyspaceConfig_replicationSpecification(rName, rSpecification string resource "aws_keyspaces_keyspace" "test" { name = %[1]q - replication_specification { + replication_specification { replication_strategy = %[2]q } }