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(ebs): Feature to create vm without snapshot #188

Closed
wants to merge 2 commits into from
Closed
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
37 changes: 21 additions & 16 deletions builder/bsu/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Config struct {
osccommon.BlockDevices `mapstructure:",squash"`
osccommon.RunConfig `mapstructure:",squash"`
VolumeRunTags osccommon.TagMap `mapstructure:"run_volume_tags"`
SkipCreateOmi bool `mapstructure:"skip_create_omi"`

ctx interpolate.Context
}
Expand Down Expand Up @@ -181,22 +182,26 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
OMIName: b.config.OMIName,
Regions: b.config.OMIRegions,
},
&stepCreateOMI{
RawRegion: b.config.RawRegion,
ProductCodes: b.config.ProductCodes,
},
&osccommon.StepUpdateOMIAttributes{
AccountIds: b.config.OMIAccountIDs,
SnapshotAccountIds: b.config.SnapshotAccountIDs,
RawRegion: b.config.RawRegion,
GlobalPermission: b.config.GlobalPermission,
Ctx: b.config.ctx,
},
&osccommon.StepCreateTags{
Tags: b.config.OMITags,
SnapshotTags: b.config.SnapshotTags,
Ctx: b.config.ctx,
},
}

if !b.config.SkipCreateOmi {
steps = append(steps,
&stepCreateOMI{
RawRegion: b.config.RawRegion,
ProductCodes: b.config.ProductCodes,
},
&osccommon.StepUpdateOMIAttributes{
AccountIds: b.config.OMIAccountIDs,
SnapshotAccountIds: b.config.SnapshotAccountIDs,
RawRegion: b.config.RawRegion,
GlobalPermission: b.config.GlobalPermission,
Ctx: b.config.ctx,
},
&osccommon.StepCreateTags{
Tags: b.config.OMITags,
SnapshotTags: b.config.SnapshotTags,
Ctx: b.config.ctx,
})
}

b.runner = commonsteps.NewRunner(steps, b.config.PackerConfig, ui)
Expand Down
2 changes: 2 additions & 0 deletions builder/bsu/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/builders/bsu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ builder.
shutdown in case Packer exits ungracefully. Possible values are "stop" and
"terminate", default is `stop`.

- `skip_create_omi` (boolean) - Set to true if you want to skip snapshot creation.
No image will be created if set to true. Default `false`.

- `skip_region_validation` (boolean) - Set to true if you want to skip
validation of the region configuration option. Default `false`.

Expand Down
Loading