diff --git a/builder/yandex/config.go b/builder/yandex/config.go index 12b7245b3..ed6b337b6 100644 --- a/builder/yandex/config.go +++ b/builder/yandex/config.go @@ -44,6 +44,8 @@ type Config struct { DiskSizeGb int `mapstructure:"disk_size_gb" required:"false"` // Specify disk type for the launched instance. Defaults to `network-hdd`. DiskType string `mapstructure:"disk_type" required:"false"` + // Key/value pair labels to apply to the temporary disk. + DiskLabels map[string]string `mapstructure:"disk_labels" required:"false"` // The description of the resulting image. ImageDescription string `mapstructure:"image_description" required:"false"` // The family name of the resulting image. diff --git a/builder/yandex/config.hcl2spec.go b/builder/yandex/config.hcl2spec.go index 8660f3b6e..4dd70db3d 100644 --- a/builder/yandex/config.hcl2spec.go +++ b/builder/yandex/config.hcl2spec.go @@ -74,6 +74,7 @@ type FlatConfig struct { DiskName *string `mapstructure:"disk_name" required:"false" cty:"disk_name" hcl:"disk_name"` DiskSizeGb *int `mapstructure:"disk_size_gb" required:"false" cty:"disk_size_gb" hcl:"disk_size_gb"` DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type" hcl:"disk_type"` + DiskLabels map[string]string `mapstructure:"disk_labels" required:"false" cty:"disk_labels" hcl:"disk_labels"` ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"` ImageFamily *string `mapstructure:"image_family" required:"false" cty:"image_family" hcl:"image_family"` ImageLabels map[string]string `mapstructure:"image_labels" required:"false" cty:"image_labels" hcl:"image_labels"` @@ -180,6 +181,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "disk_name": &hcldec.AttrSpec{Name: "disk_name", Type: cty.String, Required: false}, "disk_size_gb": &hcldec.AttrSpec{Name: "disk_size_gb", Type: cty.Number, Required: false}, "disk_type": &hcldec.AttrSpec{Name: "disk_type", Type: cty.String, Required: false}, + "disk_labels": &hcldec.AttrSpec{Name: "disk_labels", Type: cty.Map(cty.String), Required: false}, "image_description": &hcldec.AttrSpec{Name: "image_description", Type: cty.String, Required: false}, "image_family": &hcldec.AttrSpec{Name: "image_family", Type: cty.String, Required: false}, "image_labels": &hcldec.AttrSpec{Name: "image_labels", Type: cty.Map(cty.String), Required: false}, diff --git a/builder/yandex/step_create_instance.go b/builder/yandex/step_create_instance.go index 3b48096d9..9f54f2948 100644 --- a/builder/yandex/step_create_instance.go +++ b/builder/yandex/step_create_instance.go @@ -61,6 +61,7 @@ func createDisk(ctx context.Context, c *Config, d Driver, sourceImage *Image) (* Name: c.DiskName, FolderId: c.FolderID, TypeId: c.DiskType, + Labels: c.DiskLabels, ZoneId: c.Zone, Size: int64((datasize.ByteSize(c.DiskSizeGb) * datasize.GB).Bytes()), Source: &compute.CreateDiskRequest_ImageId{ diff --git a/website/pages/partials/builder/yandex/Config-not-required.mdx b/website/pages/partials/builder/yandex/Config-not-required.mdx index 2d933cb3e..cd3a4dfd3 100644 --- a/website/pages/partials/builder/yandex/Config-not-required.mdx +++ b/website/pages/partials/builder/yandex/Config-not-required.mdx @@ -9,6 +9,8 @@ - `disk_type` (string) - Specify disk type for the launched instance. Defaults to `network-hdd`. +- `disk_labels` (map[string]string) - Key/value pair labels to apply to the temporary disk. + - `image_description` (string) - The description of the resulting image. - `image_family` (string) - The family name of the resulting image.