-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathsession-34.txt
More file actions
109 lines (79 loc) · 1.62 KB
/
Copy pathsession-34.txt
File metadata and controls
109 lines (79 loc) · 1.62 KB
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
103
104
105
106
107
108
state and remote state
data.tf
ec2.tf
locals.tf
variables.tf
resource "aws_instance" "frontend" {
}
locals
local-exec
remote-exec
1. workspaces
2. tfvars
3. seperate repos
workspaces
==========
if we want to create multiple environments we can make use of terraform workspaces. terraform will give us special variable called terraform.workspace
terraform.workspace=dev
terraform.workspace=default
terraform.workspace=prod
terraform workspace select dev/prod
dev -> t3.micro
uat -> t3.small
prod -> t3.medium
advantages
=========
1. same code
2. consistent environments
disadvantages
=========
since code is same, we should be very careful, because it applies to prod also.
tfvars
======
advantages
=========
1. same code
2. consistent environments
disadvantages
=========
since code is same, we should be very careful, because it applies to prod also.
I am in prod
I applied dev values
1. command line
2. tfvars
3. env variable
4. default values
5. prompt
- dev
- prod
isolation -> non-prod and prod
different accounts for different environments
different repository
aws configure
terraform workspace select dev
terraform-ec2-dev
terraform-ec2-prod
disadvantages
==============
repeat code
advantages
==============
clear isolation
blast radius is zero
seperate states
Terraform Modules
=================
functions -> a repeated task, it will be executed whenever we call. it will take inputs and give outputs
a.sh
common.sh
a -> function common.sh
1. enforce best standards
2. code reuse
3. easy maintainance
branch names -> dev, uat and prod
feature and main
code and configuration
tfvars/
dev.tfvars
uat.tfvars
prod.tfvars