From e72d58ec80c001c93a17b264b0d0559bb0404443 Mon Sep 17 00:00:00 2001 From: M S Vishwanath Bhat Date: Sat, 23 Mar 2024 20:25:43 +0100 Subject: [PATCH 1/4] Add original_snapshot_create_time for aws_db_snapshot data source Signed-off-by: M S Vishwanath Bhat --- internal/service/rds/snapshot_data_source.go | 7 +++++++ internal/service/rds/snapshot_data_source_test.go | 4 ++++ website/docs/cdktf/python/d/db_snapshot.html.markdown | 5 +++-- website/docs/d/db_snapshot.html.markdown | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/internal/service/rds/snapshot_data_source.go b/internal/service/rds/snapshot_data_source.go index 08b0f03d75ba..cb2e9ab99d8c 100644 --- a/internal/service/rds/snapshot_data_source.go +++ b/internal/service/rds/snapshot_data_source.go @@ -89,6 +89,10 @@ func DataSourceSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "original_snapshot_create_time": { + Type: schema.TypeString, + Computed: true, + }, "port": { Type: schema.TypeInt, Computed: true, @@ -188,6 +192,9 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("kms_key_id", snapshot.KmsKeyId) d.Set("license_model", snapshot.LicenseModel) d.Set("option_group_name", snapshot.OptionGroupName) + if snapshot.OriginalSnapshotCreateTime != nil { + d.Set("original_snapshot_create_time", snapshot.OriginalSnapshotCreateTime.Format(time.RFC3339)) + } d.Set("port", snapshot.Port) d.Set("source_db_snapshot_identifier", snapshot.SourceDBSnapshotIdentifier) d.Set("source_region", snapshot.SourceRegion) diff --git a/internal/service/rds/snapshot_data_source_test.go b/internal/service/rds/snapshot_data_source_test.go index 1b86a822adb8..3959981854ec 100644 --- a/internal/service/rds/snapshot_data_source_test.go +++ b/internal/service/rds/snapshot_data_source_test.go @@ -36,11 +36,15 @@ func TestAccRDSSnapshotDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(ds1Name, "db_snapshot_arn", resourceName, "db_snapshot_arn"), resource.TestCheckResourceAttrPair(ds1Name, "db_snapshot_identifier", resourceName, "db_snapshot_identifier"), resource.TestCheckResourceAttrPair(ds1Name, "tags.%", resourceName, "tags.%"), + resource.TestCheckResourceAttrSet(ds1Name, "snapshot_create_time"), + resource.TestCheckResourceAttrSet(ds1Name, "original_snapshot_create_time"), resource.TestCheckResourceAttr(ds1Name, "tags.Name", rName), resource.TestCheckResourceAttrPair(ds2Name, "db_instance_identifier", resourceName, "db_instance_identifier"), resource.TestCheckResourceAttrPair(ds2Name, "db_snapshot_arn", resourceName, "db_snapshot_arn"), resource.TestCheckResourceAttrPair(ds2Name, "db_snapshot_identifier", resourceName, "db_snapshot_identifier"), + resource.TestCheckResourceAttrSet(ds2Name, "snapshot_create_time"), + resource.TestCheckResourceAttrSet(ds2Name, "original_snapshot_create_time"), resource.TestCheckResourceAttrPair(ds1Name, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttr(ds2Name, "tags.Name", rName), ), diff --git a/website/docs/cdktf/python/d/db_snapshot.html.markdown b/website/docs/cdktf/python/d/db_snapshot.html.markdown index ea0efcd213ac..a76ec03c03b1 100644 --- a/website/docs/cdktf/python/d/db_snapshot.html.markdown +++ b/website/docs/cdktf/python/d/db_snapshot.html.markdown @@ -97,6 +97,7 @@ This data source exports the following attributes in addition to the arguments a * `status` - Status of this DB snapshot. * `storage_type` - Storage type associated with DB snapshot. * `vpc_id` - ID of the VPC associated with the DB snapshot. -* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). +* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). Changes for the copy when the snapshot is copied. +* `original_snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). Doesn't change when the snapshot is copied. - \ No newline at end of file + diff --git a/website/docs/d/db_snapshot.html.markdown b/website/docs/d/db_snapshot.html.markdown index 7dc0e5243f15..181cc3d8eb55 100644 --- a/website/docs/d/db_snapshot.html.markdown +++ b/website/docs/d/db_snapshot.html.markdown @@ -86,4 +86,5 @@ This data source exports the following attributes in addition to the arguments a * `status` - Status of this DB snapshot. * `storage_type` - Storage type associated with DB snapshot. * `vpc_id` - ID of the VPC associated with the DB snapshot. -* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). +* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). Changes for the copy when the snapshot is copied. +* `original_snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). Doesn't change when the snapshot is copied. From b0c1c75d1d1e2b253d8ad2858762144acacf828a Mon Sep 17 00:00:00 2001 From: M S Vishwanath Bhat Date: Sat, 23 Mar 2024 21:34:44 +0100 Subject: [PATCH 2/4] Add changelog entry for PR 36544 Signed-off-by: M S Vishwanath Bhat --- .changelog/36544.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changelog/36544.txt diff --git a/.changelog/36544.txt b/.changelog/36544.txt new file mode 100644 index 000000000000..205d949b96b6 --- /dev/null +++ b/.changelog/36544.txt @@ -0,0 +1,4 @@ +```release-note:enhancement +data-source/aws_db_snapshot: Add original_snapshot_create_time attribute +``` + From 552832b9d499ffbb6455cc8ce1792675d8703725 Mon Sep 17 00:00:00 2001 From: M S Vishwanath Bhat Date: Sat, 23 Mar 2024 21:39:37 +0100 Subject: [PATCH 3/4] remove cdktf files from the commit They are generated and should not be edited directly Signed-off-by: M S Vishwanath Bhat --- website/docs/cdktf/python/d/db_snapshot.html.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/docs/cdktf/python/d/db_snapshot.html.markdown b/website/docs/cdktf/python/d/db_snapshot.html.markdown index a76ec03c03b1..6d3255205208 100644 --- a/website/docs/cdktf/python/d/db_snapshot.html.markdown +++ b/website/docs/cdktf/python/d/db_snapshot.html.markdown @@ -97,7 +97,6 @@ This data source exports the following attributes in addition to the arguments a * `status` - Status of this DB snapshot. * `storage_type` - Storage type associated with DB snapshot. * `vpc_id` - ID of the VPC associated with the DB snapshot. -* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). Changes for the copy when the snapshot is copied. -* `original_snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). Doesn't change when the snapshot is copied. +* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC). From a88371fb1756ad31f5adf13d3dbe6cbd150486d1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 25 Mar 2024 11:03:51 -0400 Subject: [PATCH 4/4] Update 36544.txt --- .changelog/36544.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/36544.txt b/.changelog/36544.txt index 205d949b96b6..fe17644cf369 100644 --- a/.changelog/36544.txt +++ b/.changelog/36544.txt @@ -1,4 +1,4 @@ ```release-note:enhancement -data-source/aws_db_snapshot: Add original_snapshot_create_time attribute +data-source/aws_db_snapshot: Add `original_snapshot_create_time` attribute ```