Skip to content

Commit

Permalink
Merge pull request #39557 from stefanfreitag/f-aws_ebs_snapshot-add-s…
Browse files Browse the repository at this point in the history
…tart-time

feat: add start_time attribute to data source aws_ebs_snapshot
  • Loading branch information
jar-b authored Oct 2, 2024
2 parents 8af9dcb + 10f644b commit 2b0ad37
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
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

0 comments on commit 2b0ad37

Please sign in to comment.