Files
Packer-Cn/builder/amazon/ebsvolume/block_device.go
T

30 lines
824 B
Go
Raw Normal View History

2016-10-31 16:44:41 -05:00
package ebsvolume
import (
2017-04-04 13:39:01 -07:00
awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/template/interpolate"
2016-10-31 16:44:41 -05:00
)
type BlockDevice struct {
awscommon.BlockDevice `mapstructure:"-,squash"`
2018-02-02 20:16:23 -08:00
Tags awscommon.TagMap `mapstructure:"tags"`
2016-10-31 16:44:41 -05:00
}
func commonBlockDevices(mappings []BlockDevice, ctx *interpolate.Context) (awscommon.BlockDevices, error) {
2016-10-31 16:44:41 -05:00
result := make([]awscommon.BlockDevice, len(mappings))
2016-10-31 16:44:41 -05:00
for i, mapping := range mappings {
interpolateBlockDev, err := interpolate.RenderInterface(&mapping.BlockDevice, ctx)
if err != nil {
return awscommon.BlockDevices{}, err
}
result[i] = *interpolateBlockDev.(*awscommon.BlockDevice)
2016-10-31 16:44:41 -05:00
}
return awscommon.BlockDevices{
LaunchBlockDevices: awscommon.LaunchBlockDevices{
LaunchMappings: result,
},
}, nil
2016-10-31 16:44:41 -05:00
}