github.phpd.cn/hashicorp/packer@v1.3.2/builder/amazon/ebsvolume/block_device.go (about) 1 package ebsvolume 2 3 import ( 4 awscommon "github.com/hashicorp/packer/builder/amazon/common" 5 "github.com/hashicorp/packer/template/interpolate" 6 ) 7 8 type BlockDevice struct { 9 awscommon.BlockDevice `mapstructure:"-,squash"` 10 Tags awscommon.TagMap `mapstructure:"tags"` 11 } 12 13 func commonBlockDevices(mappings []BlockDevice, ctx *interpolate.Context) (awscommon.BlockDevices, error) { 14 result := make([]awscommon.BlockDevice, len(mappings)) 15 16 for i, mapping := range mappings { 17 interpolateBlockDev, err := interpolate.RenderInterface(&mapping.BlockDevice, ctx) 18 if err != nil { 19 return awscommon.BlockDevices{}, err 20 } 21 result[i] = *interpolateBlockDev.(*awscommon.BlockDevice) 22 } 23 24 return awscommon.BlockDevices{ 25 LaunchBlockDevices: awscommon.LaunchBlockDevices{ 26 LaunchMappings: result, 27 }, 28 }, nil 29 }