packer-cn/website/pages/docs/builders/yandex.mdx

76 lines
2.4 KiB
Plaintext
Raw Normal View History

---
description: |
2020-03-23 20:02:12 -04:00
The yandex Packer builder is able to create images for use with
2020-03-18 18:46:47 -04:00
Yandex.Cloud based on existing images.
layout: docs
2020-03-18 18:46:47 -04:00
page_title: Yandex Compute - Builders
sidebar_title: Yandex.Cloud
---
# Yandex Compute Builder
Type: `yandex`
The `yandex` Packer builder is able to create
[images](https://cloud.yandex.com/docs/compute/concepts/images) for use with
[Yandex Compute Cloud](https://cloud.yandex.com/docs/compute/)
based on existing images.
## Authentication
2020-06-17 10:02:55 -04:00
Builder can authenticate with Yandex.Cloud using one of the following methods:
2020-03-18 18:46:47 -04:00
- OAuth token
- File with Service Account Key
2020-06-17 10:02:55 -04:00
- Service Account assigned to Compute Instance
### Authentication Using Token
To authenticate with an OAuth token only `token` config key is needed.
2020-06-17 10:02:55 -04:00
Or use the `YC_TOKEN` environment variable with proper value. Token you could get [here](https://oauth.yandex.ru/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb).
### Authentication Using Service Account Key File
To authenticate with a service account credential, only `service_account_key_file` is needed.
Or use the `YC_SERVICE_ACCOUNT_KEY_FILE` environment variable.
2020-06-17 10:02:55 -04:00
The parameter expects a value path to the service account file in json format. Check [documentation](https://cloud.yandex.com/docs/cli/operations/authentication/service-account#auth-as-sa)
about how to create SA and its key.
### Authentication Using a Compute Instance Service Account
Authentication with a Service Account on an instance happens when neither the `token` nor the `service_account_key_file` parameter is set.
To get more information about this kind of authentication check [documentaion](https://cloud.yandex.com/docs/compute/operations/vm-connect/auth-inside-vm).
-> **NB** Do not forget to assigne proper roles to Service Account, if you use this type of auth.
## Basic Example
```json
{
"type": "yandex",
"token": "YOUR OAUTH TOKEN",
"folder_id": "YOUR FOLDER ID",
"source_image_family": "ubuntu-1804-lts",
"ssh_username": "ubuntu",
"use_ipv4_nat": "true"
}
```
## Configuration Reference
Configuration options are organized below into two categories: required and
optional. Within each category, the available options are alphabetized and
described.
2020-03-31 17:40:07 -04:00
In addition to the options listed here, a [communicator](/docs/templates/communicator)
can be configured for this builder.
### Required:
2020-03-23 20:02:12 -04:00
@include 'builder/yandex/Config-required.mdx'
### Optional:
2020-03-23 20:02:12 -04:00
@include 'builder/yandex/Config-not-required.mdx'