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 original_snapshot_create_time for aws_db_snapshot data source #36544

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .changelog/36544.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:enhancement
data-source/aws_db_snapshot: Add `original_snapshot_create_time` attribute
```

7 changes: 7 additions & 0 deletions internal/service/rds/snapshot_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions internal/service/rds/snapshot_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
Expand Down
2 changes: 1 addition & 1 deletion website/docs/cdktf/python/d/db_snapshot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ This data source exports the following attributes in addition to the arguments a
* `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).

<!-- cache-key: cdktf-0.20.1 input-9f41210b58c8bb6be2c45a9fec8d65b0d0e6ca683037a4f7c19bc634c7236062 -->
<!-- cache-key: cdktf-0.20.1 input-9f41210b58c8bb6be2c45a9fec8d65b0d0e6ca683037a4f7c19bc634c7236062 -->
3 changes: 2 additions & 1 deletion website/docs/d/db_snapshot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Loading