From 38fe16e01f8c9bad6ccd395f7c66ac1cea7f2172 Mon Sep 17 00:00:00 2001 From: Luba Grinkevich Date: Mon, 10 Feb 2020 18:36:19 +0300 Subject: [PATCH] Add service account ID to config #8716 --- builder/yandex/config.go | 2 ++ builder/yandex/step_create_instance.go | 4 ++++ 2 files changed, 6 insertions(+) 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{} }