From ad12a30daef76f92c4b5c45e03da5b75d8af19c5 Mon Sep 17 00:00:00 2001 From: abregman Date: Sat, 12 Nov 2022 20:55:13 +0200 Subject: [PATCH] update --- README.md | 2 +- topics/terraform/README.md | 52 +++++++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dca3226..5f785a6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/topics/terraform/README.md b/topics/terraform/README.md index 3c9ae62..11917f1 100644 --- a/topics/terraform/README.md +++ b/topics/terraform/README.md @@ -1327,6 +1327,24 @@ dynamic "tag" { #### Misc +
+What are meta-arguments in Terraform?
+ +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 + +
+ +
+What meta-arguments are you familiar with?
+ +* 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
@@ -1367,14 +1385,9 @@ False. terraform console is ready-only.
-What are meta-arguments in Terraform?
+Explain what depends_on used for and given an example
-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.
@@ -1636,6 +1649,24 @@ module "some_module" { +
+How to manage multiple AWS accounts?
+ +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:::role/" + } +} +``` + +
+ ### Validations
@@ -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 `
+ +
+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?
+ +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. + +
\ No newline at end of file