File tree Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,44 @@ terraform apply -var-file=../../../vars/dev/rds.tfvars
2727
2828terraform destroy -var-file=../../../vars/dev/rds.tfvars
2929
30+ ## Terraform EC2 Instance Deployment
31+
32+ 1 . Navigate to the ` environment/dev ` folder:
33+
34+ ``` bash
35+ cd environment/dev
36+ ```
37+
38+ 2 . Open the ` ec2.tfvars ` file and modify it with your desired details. This file contains variables used in the Terraform configuration.
39+
40+ ## Deployment
41+
42+ 1 . Initialize Terraform in the working directory:
43+
44+ ``` bash
45+ terraform init
46+ ```
47+
48+ 2 . Create an execution plan:
49+
50+ ``` bash
51+ terraform plan -var-file=../../../vars/dev/ec2.tfvars
52+ ```
53+
54+ 3 . Apply the changes to create the EC2 instance:
55+
56+ ``` bash
57+ terraform apply -var-file=../../../vars/dev/ec2.tfvars
58+ ```
59+
60+ 4 . To destroy the EC2 instance and associated resources:
61+
62+ ``` bash
63+ terraform destroy -var-file=../../../vars/dev/ec2.tfvars
64+ ```
65+
66+ ** Note** : Always review the execution plan (` terraform plan ` ) before applying changes to avoid unintended modifications.
67+
3068## Command Reference
3169
3270Update all outputs:
@@ -39,5 +77,3 @@ Show all outputs:
3977
4078
4179
42-
43-
You can’t perform that action at this time.
0 commit comments