From 430d41fbf9f5b8deeb976abcdf31b394af70b7c4 Mon Sep 17 00:00:00 2001 From: DanHam Date: Wed, 28 Aug 2019 09:34:16 +0100 Subject: [PATCH] Add option to enable tagging of the running instances volumes * Currently this results in *all* volumes attached to the instance being tagged with the `run_volume_tags`. This includes any `ebs_volumes` for which the user may have configured other tags. * This issue will be addressed in a later commit --- builder/amazon/ebsvolume/builder.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index 941b2f958..8a5b840ae 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -23,9 +23,10 @@ type Config struct { awscommon.AccessConfig `mapstructure:",squash"` awscommon.RunConfig `mapstructure:",squash"` - AMIENASupport *bool `mapstructure:"ena_support"` - AMISriovNetSupport bool `mapstructure:"sriov_support"` - VolumeMappings []BlockDevice `mapstructure:"ebs_volumes"` + AMIENASupport *bool `mapstructure:"ena_support"` + AMISriovNetSupport bool `mapstructure:"sriov_support"` + VolumeMappings []BlockDevice `mapstructure:"ebs_volumes"` + VolumeRunTags awscommon.TagMap `mapstructure:"run_volume_tags"` launchBlockDevices awscommon.BlockDevices ctx interpolate.Context @@ -135,6 +136,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Tags: b.config.RunTags, UserData: b.config.UserData, UserDataFile: b.config.UserDataFile, + VolumeTags: b.config.VolumeRunTags, } } else { instanceStep = &awscommon.StepRunSourceInstance{ @@ -154,6 +156,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack Tags: b.config.RunTags, UserData: b.config.UserData, UserDataFile: b.config.UserDataFile, + VolumeTags: b.config.VolumeRunTags, } }