Add service account ID to config #8716

This commit is contained in:
Luba Grinkevich 2020-02-10 18:36:19 +03:00
parent ff4674a49c
commit 38fe16e01f
2 changed files with 6 additions and 0 deletions

View File

@ -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"`

View File

@ -205,6 +205,10 @@ runcmd:
},
}
if config.ServiceAccountID != "" {
req.ServiceAccountId = config.ServiceAccountID
}
if config.UseIPv6 {
req.NetworkInterfaceSpecs[0].PrimaryV6AddressSpec = &compute.PrimaryAddressSpec{}
}