-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathsession-25.txt
102 lines (72 loc) · 1.87 KB
/
session-25.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
variables
data types
loops
count based
for each
dynamic
functions
conditions
outputs
data sources
locals
state and remote state
interpolation
how to create multiple environments with terraform
----------------------------------
using tfvars
-------------
code is same --> resource definitions
DEV and PROD
------------
DEV, QA, PROD, UAT, etc.
default variable values to override --> tfvars
s3 backend
-------------
diff buckets for diff environments
variables
-----------
default values
db-dev, backend-dev, frontend-dev
db-prod backend-prod frontend-prod
db-dev.daws78s.online
backend-dev.daws78s.online
frontend-dev.daws78s.online
db-prod.daws78s.online
backend-prod.daws78s.online
frontend-prod.daws78s.online
daws78s.online
Project=Expense, Module=DB/frontend-dev/backend-dev Environemt=dev/prod Terraform=true
frontend-dev/frontend-prod
----------------------------
if key startswith frontend
terraform init -backend-config=prod/backend.tf
terraform plan -var-file=prod/prod.tfvars
workspace
-----------
dev, qa, prod
if dev t3.micro
if prod t3.small
terraform.workspace = dev, prod
variables and their values we should be very careful
seperate repo for dev, seperate repo for production
workspace, tfvars
-------------------
adv --> less code
dis --> should be more careful while dealing variables and tfvars. chance of doing something wrong in prod
seperate repos
------------------
adv --> clear seperation of environments
dis --> duplication of code
provisioners
-------------------
terraform we are creating instances....
1. local-exec --> where you are running terraform command i.e local
2. remote-exec --> inside remote machine
ip address into a file
ansible-playbook -i private_ips.txt web.yaml
Linux Server
-----------
terraform and ansible install
clone this code
and run there
create db, install ansible, pull db playbook confpull db playbook configure itself