This commit is contained in:
abregman 2022-11-12 20:55:13 +02:00
parent 21206e761e
commit ad12a30dae
2 changed files with 46 additions and 8 deletions

View File

@ -2,7 +2,7 @@
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE
:bar_chart:  There are currently **2610** exercises and questions
:bar_chart:  There are currently **2619** exercises and questions
:warning:  You can use these for preparing for an interview but most of the questions and exercises don't represent an actual interview. Please read [FAQ page](faq.md) for more details

View File

@ -1327,6 +1327,24 @@ dynamic "tag" {
#### Misc
<details>
<summary>What are meta-arguments in Terraform?</summary><br><b>
Arguments that affect the lifecycle of a resources (its creation, modification, ...) and supported by Terraform regardless to the type of resource in which they are used.
Some examples:
* count: how many resources to create out of one definition of a resource
* lifecycle: how to treat resource creation or removal
</b></details>
<details>
<summary>What meta-arguments are you familiar with?</summary><br><b>
* count: how many resources to create out of one definition of a resource
* lifecycle: how to treat resource creation or removal
* depends_on: create a dependency between resources
</b></details>
<details>
@ -1367,14 +1385,9 @@ False. terraform console is ready-only.
</b></details>
<details>
<summary>What are meta-arguments in Terraform?</summary><br><b>
<summary>Explain what <code>depends_on</code> used for and given an example</summary><br><b>
Arguments that affect the lifecycle of a resources (its creation, modification, ...) and supported by Terraform regardless to the type of resource in which they are used.
Some examples:
* count: how many resources to create out of one definition of a resource
* lifecycle: how to treat resource creation or removal
`depends_on` used to create a dependency between resources in Terraform. For example, there is an application you would like to deploy in a cluster. If the cluster isn't ready (and also managed by Terraform of course) then you can't deploy the app. In this case, you will define "depends_on" in the app configuration and its value will be the cluster resource.
</b></details>
@ -1636,6 +1649,24 @@ module "some_module" {
</b></details>
<details>
<summary>How to manage multiple AWS accounts?</summary><br><b>
One way is to define multiple different provider blocks, each with its own "assume_role"
```
provider "aws" {
region = "us-west-1"
alias = "some-region"
assume_role {
role_arn = "arn:aws:iam::<SOME_ACCOUNT_ID>:role/<SOME_ROLE_NAME>"
}
}
```
</b></details>
### Validations
<details>
@ -1845,3 +1876,10 @@ Instead of defining tags at resource level, consider using `default_tags` as par
If it's a matter of changing a resource name, you could make use of `terraform state mv <ORIGINAL_RESOURCE_NAME> <NEW_RESOURCE_NAME>`
</b></details>
<details>
<summary>You try to deploy a cluster and an app on that cluster, but the app resource was created before the cluster. How to manage such situation?</summary><br><b>
Use the meta-argument `depends_on` in the app resource definition. This way the app will depend on the cluster resource and order will be maintained in creation of the resources.
</b></details>