diff --git a/builder/yandex/config.go b/builder/yandex/config.go index 5d3952a6a..cbc07bdfe 100644 --- a/builder/yandex/config.go +++ b/builder/yandex/config.go @@ -41,6 +41,8 @@ type Config struct { // is an alternative method to authenticate to Yandex.Cloud. Alternatively you may set environment variable // YC_SERVICE_ACCOUNT_KEY_FILE. ServiceAccountKeyFile string `mapstructure:"service_account_key_file" required:"false"` + // Service account identifier to assign to instance + ServiceAccountID string `mapstructure:"service_account_id" required:"false"` // OAuth token to use to authenticate to Yandex.Cloud. Alternatively you may set // value by environment variable YC_TOKEN. Token string `mapstructure:"token" required:"true"` diff --git a/builder/yandex/step_create_instance.go b/builder/yandex/step_create_instance.go index b13cbca1e..2c4522d90 100644 --- a/builder/yandex/step_create_instance.go +++ b/builder/yandex/step_create_instance.go @@ -205,6 +205,10 @@ runcmd: }, } + if config.ServiceAccountID != "" { + req.ServiceAccountId = config.ServiceAccountID + } + if config.UseIPv6 { req.NetworkInterfaceSpecs[0].PrimaryV6AddressSpec = &compute.PrimaryAddressSpec{} }