Skip to content

Commit ee6c25e

Browse files
author
Arie Bregman
authored
Merge pull request iluwatar#60 from dmattia/dmattia/tf_qs
Added some terraform questions and answers
2 parents 4f1130d + e079926 commit ee6c25e

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

README.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,12 @@ The benefits of Terraform over the other tools:
23592359

23602360
<details>
23612361
<summary>Explain what is "Terraform configuration"</summary><br><b>
2362+
A configuration is a root module along with a tree of child modules that are called as dependencies from the root module.
2363+
</b></details>
2364+
2365+
<details>
2366+
<summary>What is HCL?</summary><br><b>
2367+
HCL stands for Hashicorp Conviguration Language. It is the language Hashicorp made to use as the configuration language for a number of its tools, including terraform.
23622368
</b></details>
23632369

23642370
<details>
@@ -2390,6 +2396,7 @@ It keeps track of the IDs of created resources so that Terraform knows what it i
23902396

23912397
<code>terraform init</code> scans your code to figure which providers are you using and download them.
23922398
<code>terraform plan</code> will let you see what terraform is about to do before actually doing it.
2399+
<code>terraform validate</code> checks if configuration is syntactically valid and internally consistent within a directory.
23932400
<code>terraform apply</code> will provision the resources specified in the .tf files.
23942401
</b></details>
23952402

@@ -2424,18 +2431,29 @@ It's a resource which was successfully created but failed during provisioning. T
24242431
<details>
24252432
<summary>What types of variables are supported in Terraform?</summary><br><b>
24262433

2427-
String
2428-
Integer
2429-
Map
2430-
List
2434+
string
2435+
number
2436+
bool
2437+
list(<TYPE>)
2438+
set(<TYPE>)
2439+
map(<TYPE>)
2440+
object({<ATTR_NAME> = <TYPE>, ... })
2441+
tuple([<TYPE>, ...])
24312442
</b></details>
24322443

24332444
<details>
24342445
<summary>What is a data source? In what scenarios for example would need to use it?</summary><br><b>
2446+
Data sources lookup or compute values that can be used elsewhere in terraform configuration.
2447+
2448+
There are quite a few cases you might need to use them:
2449+
* you want to reference resources not managed through terraform
2450+
* you want to reference resources managed by a different terraform module
2451+
* you want to cleanly compute a value with typechecking, such as with <code>aws_iam_policy_document</code>
24352452
</b></details>
24362453

24372454
<details>
24382455
<summary>What are output variables and what <code>terraform output</code> does?</summary><br><b>
2456+
Output variables are named values that are sourced from the attributes of a module. They are stored in terraform state, and can be used by other modules through <code>remote_state</code>
24392457
</b></details>
24402458

24412459
<details>
@@ -2462,7 +2480,7 @@ List
24622480

24632481
<details>
24642482
<summary>Explain "State Locking"</summary><br><b>
2465-
State locking is a mechanism that blocks an operations against a specific state file from multiple callers so as to avoid conflicting operations from different team members. Once the first caller's operation's lock is released the other team member may go ahead to
2483+
State locking is a mechanism that blocks an operations against a specific state file from multiple callers so as to avoid conflicting operations from different team members. Once the first caller's operation's lock is released the other team member may go ahead to
24662484
carryout his own operation. Nevertheless Terraform will first check the state file to see if the desired resource already exist and
24672485
if not it goes ahead to create it.
24682486
</b></details>
@@ -2472,6 +2490,17 @@ List
24722490
The random provider aids in generating numeric or alphabetic characters to use as a prefix or suffix for a desired named identifier.
24732491
</b></details>
24742492

2493+
<details>
2494+
<summary>How do you test a terraform module?</summary><br><b>
2495+
Many examples are acceptable, but the most common answer would likely to be using the tool <code>terratest</code>, and to test that a module can be initialized, can create resources, and can destroy those resources cleanly.
2496+
</b></details>
2497+
2498+
<details>
2499+
<summary>Aside from <code>.tfvars</code> files or CLI arguments, how can you inject dependencies from other modules?</summary><br><b>
2500+
The built-in terraform way would be to use <code>remote-state</code> to lookup the outputs from other modules.
2501+
It is also common in the community to use a tool called <code>terragrunt</code> to explicitly inject variables between modules.
2502+
</b></details>
2503+
24752504
## Docker
24762505

24772506
<a name="docker-beginner"></a>

0 commit comments

Comments
 (0)