Skip to content

Commit 702cad3

Browse files
authored
Merge pull request #543 from hashicorp/karthik/time_based_copy
Merge Commit: Feat: Time Based Copy for AMI's
2 parents 21e87ad + c303419 commit 702cad3

File tree

22 files changed

+715
-344
lines changed

22 files changed

+715
-344
lines changed

.github/workflows/go-validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
go-version: ${{ needs.get-go-version.outputs.go-version }}
5252
- uses: golangci/golangci-lint-action@82d40c283aeb1f2b6595839195e95c2d6a49081b # v5.0.0
5353
with:
54-
version: v1.54.2
54+
version: v1.60.1
5555
only-new-issues: true
5656
check-fmt:
5757
needs:

.web-docs/components/builder/chroot/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,18 @@ builders.
382382
the intermediary AMI into any regions provided in `ami_regions`, then
383383
delete the intermediary AMI. Default `false`.
384384

385+
- `snapshot_copy_duration_minutes` (int64) - Specify a completion duration, in 15 minute increments, to initiate a
386+
time-based AMI copy. The specified completion duration applies to each of the
387+
snapshots associated with the AMI. Each snapshot associated with the AMI will be
388+
completed within the specified completion duration, regardless of their size.
389+
390+
If you do not specify a value, the AMI copy operation is completed on a
391+
best-effort basis.
392+
393+
For more information, see [Time-based copies].
394+
395+
[Time-based copies]: https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.html
396+
385397
- `imds_support` (string) - Enforce version of the Instance Metadata Service on the built AMI.
386398
Valid options are unset (legacy) and `v2.0`. See the documentation on
387399
[IMDS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)

.web-docs/components/builder/ebs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,18 @@ necessary for this build to succeed and can be found further down the page.
235235
the intermediary AMI into any regions provided in `ami_regions`, then
236236
delete the intermediary AMI. Default `false`.
237237

238+
- `snapshot_copy_duration_minutes` (int64) - Specify a completion duration, in 15 minute increments, to initiate a
239+
time-based AMI copy. The specified completion duration applies to each of the
240+
snapshots associated with the AMI. Each snapshot associated with the AMI will be
241+
completed within the specified completion duration, regardless of their size.
242+
243+
If you do not specify a value, the AMI copy operation is completed on a
244+
best-effort basis.
245+
246+
For more information, see [Time-based copies].
247+
248+
[Time-based copies]: https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.html
249+
238250
- `imds_support` (string) - Enforce version of the Instance Metadata Service on the built AMI.
239251
Valid options are unset (legacy) and `v2.0`. See the documentation on
240252
[IMDS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)

.web-docs/components/builder/ebssurrogate/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ necessary for this build to succeed and can be found further down the page.
248248
the intermediary AMI into any regions provided in `ami_regions`, then
249249
delete the intermediary AMI. Default `false`.
250250

251+
- `snapshot_copy_duration_minutes` (int64) - Specify a completion duration, in 15 minute increments, to initiate a
252+
time-based AMI copy. The specified completion duration applies to each of the
253+
snapshots associated with the AMI. Each snapshot associated with the AMI will be
254+
completed within the specified completion duration, regardless of their size.
255+
256+
If you do not specify a value, the AMI copy operation is completed on a
257+
best-effort basis.
258+
259+
For more information, see [Time-based copies].
260+
261+
[Time-based copies]: https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.html
262+
251263
- `imds_support` (string) - Enforce version of the Instance Metadata Service on the built AMI.
252264
Valid options are unset (legacy) and `v2.0`. See the documentation on
253265
[IMDS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)

.web-docs/components/builder/instance/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ necessary for this build to succeed and can be found further down the page.
256256
the intermediary AMI into any regions provided in `ami_regions`, then
257257
delete the intermediary AMI. Default `false`.
258258

259+
- `snapshot_copy_duration_minutes` (int64) - Specify a completion duration, in 15 minute increments, to initiate a
260+
time-based AMI copy. The specified completion duration applies to each of the
261+
snapshots associated with the AMI. Each snapshot associated with the AMI will be
262+
completed within the specified completion duration, regardless of their size.
263+
264+
If you do not specify a value, the AMI copy operation is completed on a
265+
best-effort basis.
266+
267+
For more information, see [Time-based copies].
268+
269+
[Time-based copies]: https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.html
270+
259271
- `imds_support` (string) - Enforce version of the Instance Metadata Service on the built AMI.
260272
Valid options are unset (legacy) and `v2.0`. See the documentation on
261273
[IMDS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)

builder/chroot/builder.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,14 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
523523
TpmSupport: b.config.TpmSupport,
524524
},
525525
&awscommon.StepAMIRegionCopy{
526-
AccessConfig: &b.config.AccessConfig,
527-
Regions: b.config.AMIRegions,
528-
AMIKmsKeyId: b.config.AMIKmsKeyId,
529-
RegionKeyIds: b.config.AMIRegionKMSKeyIDs,
530-
EncryptBootVolume: b.config.AMIEncryptBootVolume,
531-
Name: b.config.AMIName,
532-
OriginalRegion: *ec2conn.Config.Region,
526+
AccessConfig: &b.config.AccessConfig,
527+
Regions: b.config.AMIRegions,
528+
AMIKmsKeyId: b.config.AMIKmsKeyId,
529+
RegionKeyIds: b.config.AMIRegionKMSKeyIDs,
530+
EncryptBootVolume: b.config.AMIEncryptBootVolume,
531+
Name: b.config.AMIName,
532+
OriginalRegion: *ec2conn.Config.Region,
533+
AMISnapshotCopyDurationMinutes: b.config.AMISnapshotCopyDurationMinutes,
533534
},
534535
&awscommon.StepEnableDeprecation{
535536
AccessConfig: &b.config.AccessConfig,

0 commit comments

Comments
 (0)