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

feat: add start_time attribute to data source aws_ebs_snapshot #39557

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions .changelog/39557.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
data-source/aws_ebs_snapshot: Add start_time attribute
```
5 changes: 5 additions & 0 deletions internal/service/ec2/ebs_snapshot_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func dataSourceEBSSnapshot() *schema.Resource {
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
names.AttrStartTime: {
Type: schema.TypeString,
Computed: true,
},
names.AttrState: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -177,6 +181,7 @@ func dataSourceEBSSnapshotRead(ctx context.Context, d *schema.ResourceData, meta
d.Set(names.AttrOwnerID, snapshot.OwnerId)
d.Set(names.AttrSnapshotID, snapshot.SnapshotId)
d.Set(names.AttrState, snapshot.State)
d.Set(names.AttrStartTime, aws.ToTime(snapshot.StartTime).Format(time.RFC3339))
d.Set("storage_tier", snapshot.StorageTier)
d.Set("volume_id", snapshot.VolumeId)
d.Set(names.AttrVolumeSize, snapshot.VolumeSize)
Expand Down
1 change: 1 addition & 0 deletions internal/service/ec2/ebs_snapshot_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestAccEC2EBSSnapshotDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttrPair(dataSourceName, acctest.CtTagsPercent, resourceName, acctest.CtTagsPercent),
resource.TestCheckResourceAttrPair(dataSourceName, "volume_id", resourceName, "volume_id"),
resource.TestCheckResourceAttrPair(dataSourceName, names.AttrVolumeSize, resourceName, names.AttrVolumeSize),
resource.TestCheckResourceAttrSet(dataSourceName, names.AttrStartTime),
),
},
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/ebs_snapshot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ This data source exports the following attributes in addition to the arguments a
* `volume_size` - Size of the drive in GiBs.
* `kms_key_id` - ARN for the KMS encryption key.
* `data_encryption_key_id` - The data encryption key identifier for the snapshot.
* `start_time` - Time stamp when the snapshot was initiated.
* `state` - Snapshot state.
* `storage_tier` - Storage tier in which the snapshot is stored.
* `outpost_arn` - ARN of the Outpost on which the snapshot is stored.
Expand Down
Loading