Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
abregman committed Nov 12, 2022
1 parent 21206e7 commit ad12a30
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
52 changes: 45 additions & 7 deletions topics/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -1367,14 +1385,9 @@ False. terraform console is ready-only.
</b></details>

<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:
<summary>Explain what <code>depends_on</code> used for and given an example</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` 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>

Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>

0 comments on commit ad12a30

Please sign in to comment.