Merge pull request #8717 from luba239/master
Add service account ID to config #8716
This commit is contained in:
commit
7e45a10e90
|
@ -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"`
|
||||
|
|
|
@ -59,6 +59,7 @@ type FlatConfig struct {
|
|||
Endpoint *string `mapstructure:"endpoint" required:"false" cty:"endpoint"`
|
||||
FolderID *string `mapstructure:"folder_id" required:"true" cty:"folder_id"`
|
||||
ServiceAccountKeyFile *string `mapstructure:"service_account_key_file" required:"false" cty:"service_account_key_file"`
|
||||
ServiceAccountID *string `mapstructure:"service_account_id" required:"false" cty:"service_account_id"`
|
||||
Token *string `mapstructure:"token" required:"true" cty:"token"`
|
||||
DiskName *string `mapstructure:"disk_name" required:"false" cty:"disk_name"`
|
||||
DiskSizeGb *int `mapstructure:"disk_size_gb" required:"false" cty:"disk_size_gb"`
|
||||
|
@ -153,6 +154,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
|||
"endpoint": &hcldec.AttrSpec{Name: "endpoint", Type: cty.String, Required: false},
|
||||
"folder_id": &hcldec.AttrSpec{Name: "folder_id", Type: cty.String, Required: false},
|
||||
"service_account_key_file": &hcldec.AttrSpec{Name: "service_account_key_file", Type: cty.String, Required: false},
|
||||
"service_account_id": &hcldec.AttrSpec{Name: "service_account_id", Type: cty.String, Required: false},
|
||||
"token": &hcldec.AttrSpec{Name: "token", Type: cty.String, Required: false},
|
||||
"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},
|
||||
|
|
|
@ -205,6 +205,10 @@ runcmd:
|
|||
},
|
||||
}
|
||||
|
||||
if config.ServiceAccountID != "" {
|
||||
req.ServiceAccountId = config.ServiceAccountID
|
||||
}
|
||||
|
||||
if config.UseIPv6 {
|
||||
req.NetworkInterfaceSpecs[0].PrimaryV6AddressSpec = &compute.PrimaryAddressSpec{}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
is an alternative method to authenticate to Yandex.Cloud. Alternatively you may set environment variable
|
||||
YC_SERVICE_ACCOUNT_KEY_FILE.
|
||||
|
||||
- `service_account_id` (string) - Service account identifier to assign to instance
|
||||
|
||||
- `disk_name` (string) - The name of the disk, if unset the instance name
|
||||
will be used.
|
||||
|
||||
|
|
Loading…
Reference in New Issue