-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathsession-22.txt
73 lines (54 loc) · 1.1 KB
/
session-22.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
variables
data types
conditions
loops
functions
USER=sivakumar --> declaring and assign value to variable
vars:
user: sivakumar
variable "<var-name>" {
type = string/number/bool/list/map
default = "<default-value>"
}
tagging strategy
-----------------
name of the resource
which project
which module
which environment
who created
which date
terraform.tfvars
-------------------
in variable declaration we can give default values.
terraform.tfvars will override default values in variables.
TF_VAR_<var-name>=value
conditions
------------
if(expression){
these will run if expression is true
}
else{
these will run if expression is false
}
expression ? "this will run if expression is true" : "run if false"
var.instance_name == "db" ? "t3.small" : "t3.micro"
expense
----------
if DB, instance type should be t3.small
3 instances, db, backend, frontend
if DB t3.small
and route53 records
few tags are common, project, environment, terraform
loops
------
count based loop
for loop
dynamic block loop
count.index --> 0,1,2
length(<list>)
outputs
----------
a=b, b=c, c=d
x=z, e=f, a=e
a=e, b=c, c=d, x=z, e=f