Skip to content

Commit 7ca5031

Browse files
committed
Updated Terraform and Git Videos
1 parent 7ada20f commit 7ca5031

File tree

7 files changed

+87
-69
lines changed

7 files changed

+87
-69
lines changed

‎Section 5 - Remote State Management/Readme.md‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,23 @@ The code mentioned in this document are used in the HashiCorp Certified Terrafor
88

99
| Sr No | Document Link |
1010
| ------ | ------ |
11-
| 1 | [Integrating with GIT for team management][PlDa] |
12-
| 2 | [Security Challenges in Commiting TFState to GIT][PlDb] |
13-
| 3 | [Module Sources in Terraform][PlDc] |
14-
| 4 | [Terraform and .gitignore][PlDd] |
15-
| 5 | [Terraform Backends][PlDe] |
16-
| 6 | [State Locking][PlDf] |
17-
| 7 | [S3 Backend][PlDg] |
18-
| 8 | [Terraform State Management][PlDh] | |
19-
| 9 | [Remote State Data Source Practical][PlDi]
20-
| 10 | [Terraform Import Practical][PlDj]
11+
| 1 | [Git for Team Collaboration][PlDa] |
12+
| 2 | [Security Risks of Storing Terraform State File in Git][PlDb] |
13+
| 3 | [Terraform and .gitignore][PlDc] |
14+
| 4 | [Terraform Backends][PlDd] |
15+
| 5 | [State Locking][PlDe] |
16+
| 6 | [S3 Backend][PlDf] |
17+
| 7 | [Terraform State Management][PlDg] | |
18+
| 8 | [Remote State Data Source Practical][PlDh]
19+
| 9 | [Terraform Import Practical][PlDi]
2120

2221

23-
[PlDa]: <./git-integration.md>
24-
[PlDb]: <./myrepo>
25-
[PlDc]: <./demofile.md>
26-
[PlDd]: <./tf-gitignore.md>
27-
[PlDe]: <./backend.md>
28-
[PlDf]: <./state-locking.md>
29-
[PlDg]: <./s3-backend.md>
30-
[PlDh]: <./state-management.md>
31-
[PlDi]: <./remote-state-data-source.md>
32-
[PlDj]: <./tf-import.md>
22+
[PlDa]: <./team-collaboration.md>
23+
[PlDb]: <./risks-state-file-git.md>
24+
[PlDc]: <./tf-gitignore.md>
25+
[PlDd]: <./backend.md>
26+
[PlDe]: <./state-locking.md>
27+
[PlDf]: <./s3-backend.md>
28+
[PlDg]: <./state-management.md>
29+
[PlDh]: <./remote-state-data-source.md>
30+
[PlDi]: <./tf-import.md>

‎Section 5 - Remote State Management/git-integration.md‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎Section 5 - Remote State Management/myrepo/kplabs-git/providers.tf‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎Section 5 - Remote State Management/myrepo/kplabs-git/rds.tf‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎Section 5 - Remote State Management/myrepo/rds_pass.txt‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
### Base Code for Creating RDS in AWS
3+
4+
```sh
5+
resource "aws_db_instance" "default" {
6+
allocated_storage = 10
7+
db_name = "mydb"
8+
engine = "mysql"
9+
engine_version = "8.0"
10+
instance_class = "db.t3.micro"
11+
username = "foo"
12+
password = "foobarbaz#321"
13+
parameter_group_name = "default.mysql8.0"
14+
skip_final_snapshot = true
15+
}
16+
```
17+
```sh
18+
terraform apply -auto-approve
19+
```
20+
Verify State file for Plain Text Password
21+
```sh
22+
terraform destroy -auto-approve
23+
```
24+
25+
### Using File Function
26+
Create a file on path of `outside-folder/pass.txt` with following content.
27+
```sh
28+
foobarbaz#321
29+
```
30+
Modify the `db.tf` to use `file` function.
31+
```sh
32+
resource "aws_db_instance" "default" {
33+
allocated_storage = 10
34+
db_name = "mydb"
35+
engine = "mysql"
36+
engine_version = "8.0"
37+
instance_class = "db.t3.micro"
38+
username = "foo"
39+
password = file("outside-folder/pass.txt")
40+
parameter_group_name = "default.mysql8.0"
41+
skip_final_snapshot = true
42+
}
43+
```
44+
45+
```sh
46+
terraform apply -auto-approve
47+
```
48+
Verify State file for Plain Text Password
49+
```sh
50+
terraform destroy -auto-approve
51+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
#### main.tf
3+
```sh
4+
resource "aws_security_group" "allow_tls" {
5+
name = var.sg_name
6+
description = "Managed from Terraform"
7+
}
8+
```
9+
10+
#### variables.tf
11+
```sh
12+
variable "sg_name" {}
13+
```
14+
15+
#### terraform.tfvars
16+
```sh
17+
sg_name = "kplabs-firewall"
18+
```

0 commit comments

Comments
 (0)