Skip to content

Commit efe33f8

Browse files
authored
Merge pull request #36544 from msvbhat/f-aws_db_snapshot-include-original-snapshot-create-time
Add original_snapshot_create_time for aws_db_snapshot data source
2 parents 7cadc68 + a88371f commit efe33f8

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

.changelog/36544.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```release-note:enhancement
2+
data-source/aws_db_snapshot: Add `original_snapshot_create_time` attribute
3+
```
4+

internal/service/rds/snapshot_data_source.go

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ func DataSourceSnapshot() *schema.Resource {
8989
Type: schema.TypeString,
9090
Computed: true,
9191
},
92+
"original_snapshot_create_time": {
93+
Type: schema.TypeString,
94+
Computed: true,
95+
},
9296
"port": {
9397
Type: schema.TypeInt,
9498
Computed: true,
@@ -188,6 +192,9 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in
188192
d.Set("kms_key_id", snapshot.KmsKeyId)
189193
d.Set("license_model", snapshot.LicenseModel)
190194
d.Set("option_group_name", snapshot.OptionGroupName)
195+
if snapshot.OriginalSnapshotCreateTime != nil {
196+
d.Set("original_snapshot_create_time", snapshot.OriginalSnapshotCreateTime.Format(time.RFC3339))
197+
}
191198
d.Set("port", snapshot.Port)
192199
d.Set("source_db_snapshot_identifier", snapshot.SourceDBSnapshotIdentifier)
193200
d.Set("source_region", snapshot.SourceRegion)

internal/service/rds/snapshot_data_source_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ func TestAccRDSSnapshotDataSource_basic(t *testing.T) {
3636
resource.TestCheckResourceAttrPair(ds1Name, "db_snapshot_arn", resourceName, "db_snapshot_arn"),
3737
resource.TestCheckResourceAttrPair(ds1Name, "db_snapshot_identifier", resourceName, "db_snapshot_identifier"),
3838
resource.TestCheckResourceAttrPair(ds1Name, "tags.%", resourceName, "tags.%"),
39+
resource.TestCheckResourceAttrSet(ds1Name, "snapshot_create_time"),
40+
resource.TestCheckResourceAttrSet(ds1Name, "original_snapshot_create_time"),
3941
resource.TestCheckResourceAttr(ds1Name, "tags.Name", rName),
4042

4143
resource.TestCheckResourceAttrPair(ds2Name, "db_instance_identifier", resourceName, "db_instance_identifier"),
4244
resource.TestCheckResourceAttrPair(ds2Name, "db_snapshot_arn", resourceName, "db_snapshot_arn"),
4345
resource.TestCheckResourceAttrPair(ds2Name, "db_snapshot_identifier", resourceName, "db_snapshot_identifier"),
46+
resource.TestCheckResourceAttrSet(ds2Name, "snapshot_create_time"),
47+
resource.TestCheckResourceAttrSet(ds2Name, "original_snapshot_create_time"),
4448
resource.TestCheckResourceAttrPair(ds1Name, "tags.%", resourceName, "tags.%"),
4549
resource.TestCheckResourceAttr(ds2Name, "tags.Name", rName),
4650
),

website/docs/cdktf/python/d/db_snapshot.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ This data source exports the following attributes in addition to the arguments a
9999
* `vpc_id` - ID of the VPC associated with the DB snapshot.
100100
* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
101101

102-
<!-- cache-key: cdktf-0.20.1 input-9f41210b58c8bb6be2c45a9fec8d65b0d0e6ca683037a4f7c19bc634c7236062 -->
102+
<!-- cache-key: cdktf-0.20.1 input-9f41210b58c8bb6be2c45a9fec8d65b0d0e6ca683037a4f7c19bc634c7236062 -->

website/docs/d/db_snapshot.html.markdown

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,5 @@ This data source exports the following attributes in addition to the arguments a
8686
* `status` - Status of this DB snapshot.
8787
* `storage_type` - Storage type associated with DB snapshot.
8888
* `vpc_id` - ID of the VPC associated with the DB snapshot.
89-
* `snapshot_create_time` - Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
89+
* `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.
90+
* `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.

0 commit comments

Comments
 (0)