Skip to content

Commit 4c66728

Browse files
Fix Terraform instructuion (#8693)
Co-authored-by: Ivan Blinkov <ivan@ydb.tech>
1 parent e2fecfd commit 4c66728

File tree

7 files changed

+47
-77
lines changed

7 files changed

+47
-77
lines changed

ydb/docs/en/core/devops/ansible/_includes/terraform/aws.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Create an [account](https://console.aws.amazon.com) in AWS and add enough balance to run 9 VMs. Using the [calculator] (https://calculator.aws/#/createCalculator/ec2-enhancement), you can estimate the approximate cost of maintaining infrastructure depending on the region and other circumstances.
1+
Create an [account](https://console.aws.amazon.com) in AWS and add enough balance to run 9 VMs. Using the [calculator](https://calculator.aws/#/createCalculator/ec2-enhancement), you can estimate the approximate cost of maintaining infrastructure depending on the region and other circumstances.
22

33
Create a user and connection key in AWS Cloud to run the AWS CLI:
44

ydb/docs/en/core/devops/ansible/_includes/terraform/azure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Create an [account](https://portal.azure.com/#home) in Azure and top up your [account](https://portal.azure.com/#view/Microsoft_Azure_GTM/ModernBillingMenuBlade/~/BillingAccounts) account with the amount, sufficient to operate 9 VMs. You can estimate the approximate cost of maintaining infrastructure depending on the region and other circumstances using [calculator](https://azure.com/e/26977c150e854617a888fb3a7d1a399d).
22

33
Authentication to the Azure Provider for Terraform goes through the CLI:
4-
1. You can download, install, and configure the Azure CLI by following [these instructions](https://learn.microsoft.com/ru-ru/cli/azure/install-azure-cli).
4+
1. You can download, install, and configure the Azure CLI by following [these instructions]({{ azure_docs }}/cli/azure/install-azure-cli).
55
2. Log in using the Azure CLI interactively with the `az login` command.
66
3. The easiest way to create a pair of SSH keys (Linux, macOS) is to use the `ssh-keygen` command.
77

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,32 @@
11
To create infrastructure in Yandex Cloud using Terraform, you need:
22

33
1. Prepare the cloud for work:
4-
* [Register](https://console.cloud.yandex.ru/) in Yandex Cloud.
5-
* [Connect](https://cloud.yandex.com/ru/docs/billing/concepts/billing-account) payment account.
6-
* [Make sure](https://console.cloud.yandex.ru/billing) that there are enough funds to create nine VMs.
7-
2. Install and configure Yandex Cloud CLI:
8-
* [Download](https://cloud.yandex.ru/ru/docs/cli/quickstart) Yandex Cloud CLI.
9-
* [Create](https://cloud.yandex.ru/ru/docs/cli/quickstart#initialize) profile
10-
3. [Create](https://cloud.yandex.com/ru/docs/tutorials/infrastructure-management/terraform-quickstart#get-credentials) service account using the CLI.
11-
4. [Generate](https://cloud.yandex.ru/ru/docs/cli/operations/authentication/service-account#auth-as-sa) SA key in JSON format for connecting Terraform to the cloud using the CLI: `yc iam key create --service-account-name <acc name> --output <file name> --folder-id <cloud folder id>`. An SA key will be generated, and secret information will be output to the terminal:
4+
* [Register](https://console.yandex.cloud) in Yandex Cloud.
5+
* [Connect]({{ yandex_docs }}/billing/concepts/billing-account) payment account.
6+
* [Make sure](https://billing.yandex.cloud) that there are enough funds to create nine VMs.
7+
1. Install and configure Yandex Cloud CLI:
8+
* [Download]({{ yandex_docs }}/cli/quickstart) Yandex Cloud CLI.
9+
* [Create]({{ yandex_docs }}/cli/quickstart#initialize) profile
10+
1. [Create]({{ yandex_docs }}/tutorials/infrastructure-management/terraform-quickstart#get-credentials) service account using the CLI.
11+
1. [Generate]({{ yandex_docs }}/cli/operations/authentication/service-account#auth-as-sa) Authorized key in JSON format for connecting Terraform to the cloud using the CLI: `yc iam key create --service-account-name <acc name> --output <file name> --folder-id <cloud folder id>`. Information about the created key will be displayed in the terminal:
1212
```
13-
access_key:
14-
id: ajenhnhaqgd3vp...
15-
service_account_id: aje90em65r6922...
16-
created_at: "2024-03-05T20:10:50.0150..."
17-
key_id: YCAJElaLsa0z3snzH4E...
18-
secret: YCPKNJDVhRZgyywl4hQwVdcSRC...
19-
```
20-
Copy `access_key.id` and `secret`. The values of these fields will be needed later when working with AWS CLI.
21-
5. [Download](https://aws.amazon.com/ru/cli/) AWS CLI.
22-
6. Set up the AWS CLI environment:
23-
* Run the `aws configure` command and sequentially enter the previously saved `access_key.id` and `secret`. For the region value, use `ru-central1`:
24-
```
25-
aws configure
26-
AWS Access Key ID [None]: AKIAIOSFODNN********
27-
AWS Secret Access Key [None]: wJalr********/*******/bPxRfiCYEX********
28-
Default region name [None]: ru-central1
29-
Default output format [None]:
30-
```
31-
The files `~/.aws/credentials` and `~/.aws/config` will be created.
32-
7. Edit `~/.aws/credentials` and `~/.aws/config` as follows:
33-
* Add `[Ya_def_reg]` to `~/.aws/config` before `region = ru-central1-a`.
34-
* Add `[Yandex]` before the secret information about connection keys.
35-
8. [Configure](https://cloud.yandex.com/ru/docs/tutorials/infrastructure-management/terraform-quickstart#configure-provider) Yandex Cloud Terraform provider.
36-
9. Download this repository with the command `git clone https://github.com/ydb-platform/ydb-terraform.git`.
37-
10. Go to the `yandex_cloud` directory in the downloaded repository and make changes to the following variables in the `variables.tf` file:
13+
id: ajenap572v8e1l...
14+
service_account_id: aje90em65r69...
15+
created_at: "2024-09-03T15:34:57.495126296Z"
16+
key_algorithm: RSA_2048
17+
```
18+
The authorized key will be created in the directory where the command was executed.
19+
1. [Configure]({{ yandex_docs }}/tutorials/infrastructure-management/terraform-quickstart#configure-provider) Yandex Cloud Terraform provider.
20+
1. Download this repository with the command `git clone https://github.com/ydb-platform/ydb-terraform.git`.
21+
1. Go to the `yandex_cloud` directory in the downloaded repository and make changes to the following variables in the `variables.tf` file:
3822
* `key_path` – path to the SA key generated using the CLI.
3923
* `cloud_id` – cloud ID. You can get a list of available clouds with the command `yc resource-manager cloud list`.
40-
* `profile` – profile name from the file `~/.aws/config`.
4124
* `folder_id` – Cloud folder ID. Can be obtained with the command `yc resource-manager folder list`.
4225
4326
Now, being in the `yandex_cloud` subdirectory, you can run the following sequence of commands to install the provider, initialize modules, and create the infrastructure:
4427
4528
1. `terraform init` – installing the provider and initializing modules.
46-
2. `terraform plan` – creating a plan for future infrastructure.
47-
3. `terraform init` – create resources in the cloud.
29+
1. `terraform plan` – creating a plan for future infrastructure.
30+
1. `terraform init` – create resources in the cloud.
4831
49-
Next, use the commands `terraform plan`, `terraform init`, and `terraform destroy` (destruction of the created infrastructure) to apply further changes as necessary.
32+
Next, use the commands `terraform plan`, `terraform init`, and `terraform destroy` (destruction of the created infrastructure) to apply further changes as necessary.

ydb/docs/en/presets.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
default:
22
lang: en
33
pub-cover-size: 700x400
4+
yandex_docs: https://yandex.cloud/en/docs
5+
azure_docs: https://learn.microsoft.com/en-us
46
team:
57
blinkov:
68
name: Ivan Blinkov

ydb/docs/ru/core/devops/ansible/_includes/terraform/azure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Аутентификация в провайдере Azure для Terraform осуществляется через CLI:
44

5-
1. Скачать, установить и настроить Azure CLI можно, следуя [этой](https://learn.microsoft.com/ru-ru/cli/azure/install-azure-cli) инструкции.
5+
1. Скачать, установить и настроить Azure CLI можно, следуя [этой]({{ azure_docs }}/cli/azure/install-azure-cli) инструкции.
66
2. Авторизоваться в Azure с помощью Azure CLI можно в интерактивном режиме командой `az login`, а для создания пары SSH-ключей (Linux, macOS) проще всего будет воспользоваться командой `ssh-keygen`.
77

88
После авторизации в Azure и генерации SSH-ключей нужно изменить дефолтное значение следующих переменных в корневом файле `variables.tf`:
Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,38 @@
11
Для создания инфраструктуры в Yandex Cloud с помощью Terraform нужно:
22

33
1. Подготовить облако к работе:
4-
* [Зарегистрироваться](https://console.cloud.yandex.ru/) в Yandex Cloud.
5-
* [Подключить](https://cloud.yandex.com/ru/docs/billing/concepts/billing-account) платежный аккаунт.
6-
* [Убедится](https://console.cloud.yandex.ru/billing) в наличии достаточного количества средств для создания девяти ВМ.
7-
2. Установить и настроить Yandex Cloud CLI:
8-
* [Скачать](https://cloud.yandex.ru/ru/docs/cli/quickstart) Yandex Cloud CLI.
9-
* [Создать](https://cloud.yandex.ru/ru/docs/cli/quickstart#initialize) профиль
10-
3. [Создать](https://cloud.yandex.com/ru/docs/tutorials/infrastructure-management/terraform-quickstart#get-credentials) сервисный аккаунт с помощью CLI.
11-
4. [Сгенерировать](https://cloud.yandex.ru/ru/docs/cli/operations/authentication/service-account#auth-as-sa) SA ключ в JSON формате для подключения Terraform к облаку с помощью CLI: `yc iam key create --service-account-name <acc name> --output <file name> --folder-id <cloud folder id>`. Будет сгенерирован SA ключ, а в терминал будет выведена секретная информация:
4+
* [Зарегистрироваться](https://console.yandex.cloud) в Yandex Cloud.
5+
* [Подключить]({{ yandex_docs }}/billing/concepts/billing-account) платежный аккаунт.
6+
* [Убедится](https://billing.yandex.cloud/) в наличии достаточного количества средств для создания девяти ВМ.
7+
1. Установить и настроить Yandex Cloud CLI:
8+
* [Скачать]({{ yandex_docs }}/cli/quickstart) Yandex Cloud CLI.
9+
* [Создать]({{ yandex_docs }}/cli/quickstart#initialize) профиль
10+
1. [Создать]({{ yandex_docs }}/tutorials/infrastructure-management/terraform-quickstart#get-credentials) сервисный аккаунт с помощью CLI.
11+
1. [Сгенерировать]({{ yandex_docs }}/cli/operations/authentication/service-account#auth-as-sa) авторизованный ключ в JSON формате для подключения Terraform к облаку с помощью CLI: `yc iam key create --service-account-name <acc name> --output <file name> --folder-id <cloud folder id>`. В терминал будет выведена информация о созданном ключе:
1212
```
13-
access_key:
14-
id: ajenhnhaqgd3vp...
15-
service_account_id: aje90em65r6922...
16-
created_at: "2024-03-05T20:10:50.0150..."
17-
key_id: YCAJElaLsa0z3snzH4E...
18-
secret: YCPKNJDVhRZgyywl4hQwVdcSRC...
13+
id: ajenap572v8e1l...
14+
service_account_id: aje90em65r69...
15+
created_at: "2024-09-03T15:34:57.495126296Z"
16+
key_algorithm: RSA_2048
1917
```
20-
Скопируйте `access_key.id` и `secret`. Значения этих полей нужны будут в дальнейшем при работе с AWS CLI.
21-
5. [Скачать](https://aws.amazon.com/ru/cli/) AWS CLI.
22-
6. Настроить окружение AWS CLI:
23-
* Запустите команду `aws configure` и последовательно введите сохраненные ранее `access_key.id` и `secret`. Для значения региона используйте `ru-central1`:
24-
```
25-
aws configure
26-
AWS Access Key ID [None]: AKIAIOSFODNN********
27-
AWS Secret Access Key [None]: wJalr********/*******/bPxRfiCYEX********
28-
Default region name [None]: ru-central1
29-
Default output format [None]:
30-
```
31-
Будут созданы файлы `~/.aws/credentials` и `~/.aws/config`.
32-
7. Отредактировать `~/.aws/credentials` и `~/.aws/config` следующим образом:
33-
* Добавьте `[Ya_def_reg]` в `~/.aws/config` перед `region = ru-central1-a`.
34-
* Добавьте `[Yandex]` перед секретной информацией о ключах подключения.
35-
8. [Настроить](https://cloud.yandex.com/ru/docs/tutorials/infrastructure-management/terraform-quickstart#configure-provider) Yandex Cloud Terraform провайдера.
36-
9. Скачать данный репозиторий командой `git clone https://github.com/ydb-platform/ydb-terraform.git`.
37-
10. Перейти в директорию `yandex_cloud` (директория в скаченном репозитории) и внести изменения в следующие переменные, в файле `variables.tf`:
38-
* `key_path` – путь к сгенерированному SA ключу с помощью CLI.
18+
Авторизованный ключ будет создан в директории, где вызывалась команда.
19+
1. [Настроить]({{ yandex_docs }}/tutorials/infrastructure-management/terraform-quickstart#configure-provider) Yandex Cloud Terraform провайдера.
20+
1. Скачать данный репозиторий командой `git clone https://github.com/ydb-platform/ydb-terraform.git`.
21+
1. Перейти в директорию `yandex_cloud` (директория в скаченном репозитории) и внести изменения в следующие переменные, в файле `variables.tf`:
22+
* `key_path` – путь к сгенерированному авторизованному ключу с помощью CLI.
3923
* `cloud_id` – ID облака. Можно получить список доступных облаков командой `yc resource-manager cloud list`.
40-
* `profile` – название профиля из файла `~/.aws/config`.
4124
* `folder_id` – ID Cloud folder. Можно получить командой `yc resource-manager folder list`.
4225
4326
Теперь, находясь в поддиректории `yandex_cloud`, можно выполнить последовательность следующих команд для установки провайдера, инициализации модулей и создания инфраструктуры:
4427
4528
1. `terraform init` – установка провайдера и инициализация модулей.
46-
2. `terraform plan` – создание плана будущей инфраструктуры.
47-
3. `terraform apply` (повторное выполнение) – создание ресурсов в облаке.
29+
1. `terraform plan` – создание плана будущей инфраструктуры.
30+
1. `terraform apply` (повторное выполнение) – создание ресурсов в облаке.
4831
4932
Далее используются команды `terraform plan`, `terraform apply` и `terraform destroy` (уничтожение созданной инфраструктуры).
5033
5134
{% note info %}
5235
53-
С помощью Yandex Cloud провайдера можно не только создавать инфраструктуру для дальнейшего развертывания на ней {{ ydb-short-name }} кластера с помощью [Ansible](../../initial-deployment.md), но и управлять [serverless или dedicated](https://cloud.yandex.ru/ru/services/ydb) версией {{ ydb-short-name }} прямо из Terraform. О возможностях работы с {{ ydb-short-name }} в Yandex Cloud читайте в разделе [Работа с YDB через Terraform](https://cloud.yandex.ru/ru/docs/ydb/terraform/intro) документации Yandex Cloud.
36+
С помощью Yandex Cloud провайдера можно не только создавать инфраструктуру для дальнейшего развертывания на ней {{ ydb-short-name }} кластера с помощью [Ansible](../../initial-deployment.md), но и управлять [serverless или dedicated](https://yandex.cloud/ru/services/ydb) версией {{ ydb-short-name }} прямо из Terraform. О возможностях работы с {{ ydb-short-name }} в Yandex Cloud читайте в разделе [Работа с YDB через Terraform]({{ yandex_docs }}/ydb/terraform/intro) документации Yandex Cloud.
5437
5538
{% endnote %}

ydb/docs/ru/presets.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
default:
22
lang: ru
33
pub-cover-size: 700x400
4+
yandex_docs: https://cloud.yandex/ru/docs
5+
azure_docs: https://learn.microsoft.com/ru-ru
46
team:
57
babich:
68
name: Михаил Бабич

0 commit comments

Comments
 (0)