You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,13 +146,14 @@ This diagram shows the namespaces used in the cluster and the services deployed
146
146
## Useful tools
147
147
148
148
-[tfenv](https://github.com/tfutils/tfenv) - tool for managing different versions of terraform; the required version can be specified directly as an argument or via `.terraform-version`
149
+
-[tgenv](https://github.com/cunymatthieu/tgenv) - tool for managing different versions of terragrunt; the required version can be specified directly as an argument or via `.terragrunt-version`
149
150
-[terraform](https://www.terraform.io/) - terraform itself, our main development tool: `tfenv install`
150
151
-[awscli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) - console utility to work with AWS API
151
152
-[kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) - conssole utility to work with Kubernetes API
152
153
-[kubectx + kubens](https://github.com/ahmetb/kubectx) - power tools for kubectl help you switch between Kubernetes clusters and namespaces
153
154
-[helm](https://helm.sh/docs/intro/install/) - tool to create application packages and deploy them into k8s
154
155
-[helmfile](https://github.com/roboll/helmfile) - "docker compose" for helm
155
-
-[terragrunt](https://terragrunt.gruntwork.io/) - small terraform wrapper providing DRY approach in some cases
156
+
-[terragrunt](https://terragrunt.gruntwork.io/) - small terraform wrapper providing DRY approach in some cases: `tgenv install`
156
157
-[awsudo](https://github.com/meltwater/awsudo) - simple console utility that allows running awscli commands assuming specific roles
157
158
-[aws-vault](https://github.com/99designs/aws-vault) - tool for securely managing AWS keys and running console commands
158
159
-[aws-mfa](https://github.com/broamski/aws-mfa) - utility for automating the reception of temporary STS tockens when MFA is enabled
@@ -349,6 +350,9 @@ Details can be found [here](https://www.terraform.io/docs/cli/run/index.html)
349
350
350
351
### terragrunt
351
352
353
+
* Terragrunt version: `0.29.2`
354
+
> Terragrunt version pinned in`terragrunt.hcl` file.
355
+
352
356
We've also used `terragrunt` to simplify s3 bucket creation and terraform backend configuration. All you need to do is to set s3 bucket name in the `TF_REMOTE_STATE_BUCKET` env variable and run terragrunt command in the `terraform/` directory:
353
357
354
358
```bash
@@ -359,6 +363,43 @@ We've also used `terragrunt` to simplify s3 bucket creation and terraform backen
359
363
360
364
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.
361
365
366
+
#### Apply infrastructure by layers with `terragrunt`
367
+
368
+
Go to layer folder `terraform/layer1-aws/` or `terraform/layer2-k8s/` and run this command:
369
+
370
+
```
371
+
terragrunt apply
372
+
```
373
+
374
+
> The `layer2-k8s` has a dependence on `layer1-aws`.
375
+
376
+
#### Target apply by `terragrunt`
377
+
378
+
Go to layer folder `terraform/layer1-aws/` or `terraform/layer2-k8s/` and run this command:
379
+
380
+
```
381
+
terragrunt apply -target=module.eks
382
+
```
383
+
384
+
> The `-target` is formed from the following parts `resource type` and `resource name`.
385
+
> For example: `-target=module.eks`, `-target=helm_release.loki_stack`
386
+
387
+
#### Destroy infrastructure by `terragrunt`
388
+
389
+
To destroy both layers, run this command from `terraform/` folder:
390
+
391
+
```
392
+
terragrant run-all destroy
393
+
```
394
+
395
+
To destroy `layer2-k8s`, run this command from `terraform/layare2-k8s` folder:
396
+
397
+
```
398
+
terragrunt destroy
399
+
```
400
+
401
+
> The `layer2-k8s` has dependence from `layer1-aws` and when you destroy `layer1-aws`, `layer2-k8s` destroyed automatically.
402
+
362
403
## What to do after deployment
363
404
364
405
After applying this configuration, you will get the infrastructure described and outlined at the beginning of the document. In AWS and within the EKS cluster, the basic resources and services necessary for the operation of the EKS k8s cluster will be created.
0 commit comments