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

Add approximate_creation_date_time_precision to aws_dynamodb_kinesis_streaming_destination #38098

Merged
merged 23 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
20c5d38
add new property for kinesis data streams to set timestamp precision,…
rob93c Jun 24, 2024
cddfd5c
configure attribute properties for approximate create date time preci…
rob93c Jun 24, 2024
0a91788
implement logic to populate approximate creation date time precision …
rob93c Jun 24, 2024
bc8b49a
add test to check on the correct value of the field approximate creat…
rob93c Jun 24, 2024
78a6c8c
change required schema value to optional to improve readability
rob93c Jun 24, 2024
7b5035b
configure resource to force recreation if the new attribute changes
rob93c Jun 24, 2024
cf2dd25
add changelog entry
rob93c Jun 24, 2024
796af8b
f/aws_firehose_delivery_stream iceberg destination
sonya Oct 23, 2024
a109be8
Add CHANGELOG entry.
ewbankkit Oct 23, 2024
d69eeca
Cosmetics.
ewbankkit Oct 23, 2024
1344b18
Run 'make fix-constants PKG=firehose'.
ewbankkit Oct 23, 2024
6a87fba
Fix acceptance test configuration terrafmt errors.
ewbankkit Oct 23, 2024
103d3ab
Fix 'Interpolation-only expressions are deprecated in Terraform v0.12…
ewbankkit Oct 23, 2024
b459c56
Fix documentation terrafmt errors.
ewbankkit Oct 23, 2024
fa36887
Tweak 'TestAccFirehoseDeliveryStream_basic'.
ewbankkit Oct 23, 2024
b7bb768
Run 'make fmt'.
ewbankkit Oct 23, 2024
a8fc470
Merge branch 'main' into HEAD
ewbankkit Oct 23, 2024
87381e3
Remove 'approximate_creation_date_time_precision' as a named constant.
ewbankkit Oct 23, 2024
805261d
Run 'make gen'.
ewbankkit Oct 23, 2024
f85fc8a
'approximate_creation_date_time_precision' is Computed.
ewbankkit Oct 23, 2024
e296328
Merge commit 'b7bb7684e9105a4671a8d09242ad1def0a40744d' into HEAD
ewbankkit Oct 23, 2024
ca407ae
Fix documentation terrafmt errors.
ewbankkit Oct 23, 2024
fadb835
Skip 'TestAccFirehoseDeliveryStream_icebergUpdates'.
ewbankkit Oct 23, 2024
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/38098.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_dynamodb_kinesis_streaming_destination: Add `approximate_creation_date_time_precision` argument
```
3 changes: 3 additions & 0 deletions .changelog/39844.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_kinesis_firehose_delivery_stream: Add `iceberg_configuration` argument
```
18 changes: 17 additions & 1 deletion internal/service/dynamodb/kinesis_streaming_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ func resourceKinesisStreamingDestination() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"approximate_creation_date_time_precision": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateDiagFunc: enum.Validate[awstypes.ApproximateCreationDateTimePrecision](),
},
names.AttrStreamARN: {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -73,6 +80,12 @@ func resourceKinesisStreamingDestinationCreate(ctx context.Context, d *schema.Re
TableName: aws.String(tableName),
}

if v, ok := d.GetOk("approximate_creation_date_time_precision"); ok {
input.EnableKinesisStreamingConfiguration = &awstypes.EnableKinesisStreamingConfiguration{
ApproximateCreationDateTimePrecision: awstypes.ApproximateCreationDateTimePrecision(v.(string)),
}
}

if _, err := conn.EnableKinesisStreamingDestination(ctx, input); err != nil {
return sdkdiag.AppendErrorf(diags, "enabling DynamoDB Kinesis Streaming Destination (%s): %s", id, err)
}
Expand Down Expand Up @@ -108,6 +121,7 @@ func resourceKinesisStreamingDestinationRead(ctx context.Context, d *schema.Reso
return sdkdiag.AppendErrorf(diags, "reading DynamoDB Kinesis Streaming Destination (%s): %s", d.Id(), err)
}

d.Set("approximate_creation_date_time_precision", output.ApproximateCreationDateTimePrecision)
d.Set(names.AttrStreamARN, output.StreamArn)
d.Set(names.AttrTableName, tableName)

Expand All @@ -131,7 +145,7 @@ func resourceKinesisStreamingDestinationDelete(ctx context.Context, d *schema.Re
}

if err != nil {
return sdkdiag.AppendErrorf(diags, "disabling DynamoDB Kinesis Streaming Destination (%s): %s", d.Id(), err)
return sdkdiag.AppendErrorf(diags, "reading DynamoDB Kinesis Streaming Destination (%s): %s", d.Id(), err)
}

log.Printf("[DEBUG] Deleting DynamoDB Kinesis Streaming Destination: %s", d.Id())
Expand Down Expand Up @@ -243,6 +257,7 @@ func waitKinesisStreamingDestinationActive(ctx context.Context, conn *dynamodb.C

if output, ok := outputRaw.(*awstypes.KinesisDataStreamDestination); ok {
tfresource.SetLastError(err, errors.New(aws.ToString(output.DestinationStatusDescription)))

return output, err
}

Expand All @@ -264,6 +279,7 @@ func waitKinesisStreamingDestinationDisabled(ctx context.Context, conn *dynamodb

if output, ok := outputRaw.(*awstypes.KinesisDataStreamDestination); ok {
tfresource.SetLastError(err, errors.New(aws.ToString(output.DestinationStatusDescription)))

return output, err
}

Expand Down
48 changes: 46 additions & 2 deletions internal/service/dynamodb/kinesis_streaming_destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,38 @@ func TestAccDynamoDBKinesisStreamingDestination_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccKinesisStreamingDestinationConfig_basic(rName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckKinesisStreamingDestinationExists(ctx, resourceName),
resource.TestCheckResourceAttr(resourceName, "approximate_creation_date_time_precision", ""),
acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrStreamARN, "kinesis", regexache.MustCompile(fmt.Sprintf("stream/%s", rName))),
resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccDynamoDBKinesisStreamingDestination_approximateCreationDateTimePrecision(t *testing.T) {
ctx := acctest.Context(t)
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
resourceName := "aws_dynamodb_kinesis_streaming_destination.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, names.DynamoDBServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckKinesisStreamingDestinationDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccKinesisStreamingDestinationConfig_approximateCreationDateTimePrecision(rName, "MICROSECOND"),
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisStreamingDestinationExists(ctx, resourceName),
resource.TestCheckResourceAttr(resourceName, "approximate_creation_date_time_precision", "MICROSECOND"),
acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrStreamARN, "kinesis", regexache.MustCompile(fmt.Sprintf("stream/%s", rName))),
resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName),
),
Expand Down Expand Up @@ -95,7 +125,7 @@ func TestAccDynamoDBKinesisStreamingDestination_Disappears_dynamoDBTable(t *test
})
}

func testAccKinesisStreamingDestinationConfig_basic(rName string) string {
func testAccKinesisStreamingDestinationConfig_base(rName string) string {
return fmt.Sprintf(`
resource "aws_dynamodb_table" "test" {
name = %[1]q
Expand All @@ -113,12 +143,26 @@ resource "aws_kinesis_stream" "test" {
name = %[1]q
shard_count = 2
}
`, rName)
}

func testAccKinesisStreamingDestinationConfig_basic(rName string) string {
return acctest.ConfigCompose(testAccKinesisStreamingDestinationConfig_base(rName), `
resource "aws_dynamodb_kinesis_streaming_destination" "test" {
table_name = aws_dynamodb_table.test.name
stream_arn = aws_kinesis_stream.test.arn
}
`, rName)
`)
}

func testAccKinesisStreamingDestinationConfig_approximateCreationDateTimePrecision(rName, precision string) string {
return acctest.ConfigCompose(testAccKinesisStreamingDestinationConfig_base(rName), fmt.Sprintf(`
resource "aws_dynamodb_kinesis_streaming_destination" "test" {
table_name = aws_dynamodb_table.test.name
stream_arn = aws_kinesis_stream.test.arn
approximate_creation_date_time_precision = %[1]q
}
`, precision))
}

func testAccCheckKinesisStreamingDestinationExists(ctx context.Context, n string) resource.TestCheckFunc {
Expand Down
Loading
Loading