Skip to content

Commit ab75f21

Browse files
committed
#26 Fixed tfvars placement, fixed readmes
1 parent 982e175 commit ab75f21

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

README-RU.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232

233233
#### S3 state backend
234234

235-
В качестве бэкенда для хранения стейтов терраформа и для обмена данными между слоями используется S3. Есть два способа настроить бэкенд - создать вручную `backend.tf` файл в каджом слое. Более простой способ, это выполнить:
235+
В качестве бэкенда для хранения стейтов терраформа и для обмена данными между слоями используется S3. Есть два способа настроить бэкенд: создать вручную `backend.tf` файл в каждом слое и более простой способ - выполнить из `terraform/`:
236236

237237
```bash
238238
$ export TF_REMOTE_STATE_BUCKET=my-new-state-bucket
@@ -241,7 +241,11 @@
241241

242242
#### Входные данные
243243

244-
В файле `terraform/demo.tfvars.example` представлен пример со значениями для терраформа. Скопируйте его в `terraform/terraform.tfvars` и отредактируйте по своему сомотрению.
244+
В файле `terraform/demo.tfvars.example` представлен пример со значениями для терраформа. Скопируйте его в `terraform/terraform.tfvars` и отредактируйте по своему усмотрению:
245+
246+
```bash
247+
$ cp terraform/layer1-aws/demo.tfvars.example terraform/layer1-aws/terraform.tfvars
248+
```
245249

246250
> Все возможные параметры можно посмотреть в Readme для каждого слоя.
247251
@@ -284,7 +288,7 @@
284288
Команда `terraform init` используется для инициализации стейта и его бэкенда, провайдеров, плагинов и модулей. Это первая команда, которую необходимо выполнить в `layer1` и `layer2`:
285289

286290
```bash
287-
$ terraform init --var-file=../terraform.tfvars
291+
$ terraform init
288292
```
289293

290294
Правильный аутпут:
@@ -304,7 +308,7 @@
304308
Команда `terraform plan` считывает стейт терраформа, конфигурационные файлы и выводит список изменений и действий, которые необходимо произвести, чтобы привести стейт в соответствие с конфигурацией. Удобный способ проверить изменения перед применением. В случае использования с параметром `-out` сохраняет пакет изменений в указанный файл, который позже можно будет использовать при `terraform apply`. Пример вызова:
305309

306310
```bash
307-
$ terraform plan --var-file=../terraform.tfvars
311+
$ terraform plan
308312
# ~600 rows skipped
309313
Plan: 82 to add, 0 to change, 0 to destroy.
310314

@@ -320,7 +324,7 @@
320324
Команда `terraform apply` сканирует `.tf` в текущей директории и приводит стейт к описанной в них конфигурации, производя изменения в инфраструктуре. По умолчанию перед применение производится `plan` с диалогом о продолжении. Опционально можно указать в качестве инпута сохраненный план файл:
321325
322326
```bash
323-
$ terraform apply --var-file=../terraform.tfvars
327+
$ terraform apply
324328
# ~600 rows skipped
325329
Plan: 82 to add, 0 to change, 0 to destroy.
326330

@@ -350,8 +354,8 @@
350354
351355
```bash
352356
$ export TF_REMOTE_STATE_BUCKET=my-new-state-bucket
353-
$ terragrunt run-all init --var-file=../terraform.tfvars
354-
$ terragrunt run-all apply --var-file=../terraform.tfvars
357+
$ terragrunt run-all init
358+
$ terragrunt run-all apply
355359
```
356360
357361
Таким образом `terragrunt` создаст бакет, подготовит бэкенд терраформа, последовательно в layer-1 и layer-2 произведет `terraform init` и `terraform apply`.

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Further in the [IAM](https://console.aws.amazon.com/iam/home#/home) console:
230230

231231
#### S3 state backend
232232

233-
S3 is used as a backend for storing terraform state and for exchanging data between layers. You can manually create s3 bucket and then put backend setting into `backend.tf` file in each layer. Alternatively you can run:
233+
S3 is used as a backend for storing terraform state and for exchanging data between layers. You can manually create s3 bucket and then put backend setting into `backend.tf` file in each layer. Alternatively you can run from `terraform/` directory:
234234

235235
```bash
236236
$ export TF_REMOTE_STATE_BUCKET=my-new-state-bucket
@@ -239,7 +239,13 @@ S3 is used as a backend for storing terraform state and for exchanging data betw
239239

240240
#### Inputs
241241

242-
File `terraform/demo.tfvars.example` contains example values. Copy this file to `terraform/terraform.tfvars` and set you values. You can find all possible variables in each layer's Readme.
242+
File `terraform/layer1-aws/demo.tfvars.example` contains example values. Copy this file to `terraform/layer1-aws/terraform.tfvars` and set you values:
243+
244+
```bash
245+
$ cp terraform/layer1-aws/demo.tfvars.example terraform/layer1-aws/terraform.tfvars
246+
```
247+
248+
> You can find all possible variables in each layer's Readme.
243249
244250
#### Secrets
245251

@@ -280,7 +286,7 @@ By default, the variable `create_acm_certificate` is set to `false`. Which instr
280286
The `terraform init` command is used to initialize the state and its backend, downloads providers, plugins, and modules. This is the first command to be executed in `layer1` and `layer2`:
281287

282288
```bash
283-
$ terraform init --var-file=../terraform.tfvars
289+
$ terraform init
284290
```
285291

286292
Correct output:
@@ -300,7 +306,7 @@ The `terraform init` command is used to initialize the state and its backend, do
300306
The `terraform plan` command reads terraform state and configuration files and displays a list of changes and actions that need to be performed to bring the state in line with the configuration. It's a convenient way to test changes before applying them. When used with the `-out` parameter, it saves a batch of changes to a specified file that can later be used with `terraform apply`. Call example:
301307

302308
```bash
303-
$ terraform plan --var-file=../terraform.tfvars
309+
$ terraform plan
304310
# ~600 rows skipped
305311
Plan: 82 to add, 0 to change, 0 to destroy.
306312

@@ -316,7 +322,7 @@ The `terraform plan` command reads terraform state and configuration files and d
316322
The `terraform apply` command scans `.tf` in the current directory and brings the state to the configuration described in them by making changes in the infrastructure. By default, `plan` with a continuation dialog is performed before applying. Optionally, you can specify a saved plan file as input:
317323
318324
```bash
319-
$ terraform apply --var-file=../terraform.tfvars
325+
$ terraform apply
320326
# ~600 rows skipped
321327
Plan: 82 to add, 0 to change, 0 to destroy.
322328

@@ -345,8 +351,8 @@ We've also used `terragrunt` to simplify s3 bucket creation and terraform backen
345351
346352
```bash
347353
$ export TF_REMOTE_STATE_BUCKET=my-new-state-bucket
348-
$ terragrunt run-all init --var-file=../terraform.tfvars
349-
$ terragrunt run-all apply --var-file=../terraform.tfvars
354+
$ terragrunt run-all init
355+
$ terragrunt run-all apply
350356
```
351357
352358
By running this `terragrunt` will create s3 bucket, configure terraform backend and then will run `terraform init` and `terraform apply` in layer-1 and layer-2 sequentially.
File renamed without changes.

0 commit comments

Comments
 (0)