File tree Expand file tree Collapse file tree 3 files changed +78
-6
lines changed
Section 2 - Read, Generate, Modify Congiruations Expand file tree Collapse file tree 3 files changed +78
-6
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,11 @@ The code mentioned in this document are used in the HashiCorp Certified Terrafor
5353| 44 | [ LifeCycle Meta-Argument - Prevent Destroy] [ PlEk ] |
5454| 45 | [ LifeCycle Meta-Argument - Ignore Changes] [ PlEl ] |
5555| 46 | [ Challenges with Count] [ PlEm ] |
56- | 47 | [ Data Type - SET ] [ PlEn ] |
57- | 48 | [ for_each in Terraform] [ PlEo ] |
58- | 49 | [ Data Type - Object] [ PlEo ] |
56+ | 47 | [ Resource Dependency] [ PlEn ] |
57+ | 48 | [ Implicit vs Explicit Dependencies] [ PlEo ] |
58+ | 49 | [ Data Type - SET ] [ PlEp ] |
59+ | 50 | [ for_each in Terraform] [ PlEq ] |
60+ | 51 | [ Data Type - Object] [ PlEr ] |
5961
6062[ PlDa ] : < ./firewall.md >
6163[ PlDb ] : < ./doc-code-changes.md >
@@ -103,6 +105,8 @@ The code mentioned in this document are used in the HashiCorp Certified Terrafor
103105[ PlEk ] : < ./prevent-destroy.md >
104106[ PlEl ] : < ./ignore-changes.md >
105107[ PlEm ] : < ./challenge-count.md >
106- [ PlEn ] : < ./data-type-set.md >
107- [ PlEo ] : < ./for_each.md >
108- [ PlEp ] : < ./object.md >
108+ [ PlEn ] : < ./resource-dependency.md >
109+ [ PlEo ] : < ./implicit.md >
110+ [ PlEp ] : < ./data-type-set.md >
111+ [ PlEq ] : < ./for_each.md >
112+ [ PlEr ] : < ./object.md >
Original file line number Diff line number Diff line change 1+ ### Base Code Used:
2+
3+ ``` sh
4+ resource " aws_instance" " example" {
5+ ami = " ami-0e449927258d45bc4"
6+ instance_type = " t2.micro"
7+ }
8+
9+ resource " aws_security_group" " prod" {
10+ name = " production-sg"
11+ }
12+ ```
13+
14+ ### Final Code
15+
16+ ``` sh
17+ resource " aws_instance" " example" {
18+ ami = " ami-0e449927258d45bc4"
19+ instance_type = " t2.micro"
20+ vpc_security_group_ids = [aws_security_group.prod.id]
21+ }
22+
23+ resource " aws_security_group" " prod" {
24+ name = " production-sg"
25+ }
26+ ```
27+
28+ ``` sh
29+ terraform apply -auto-approve
30+
31+ terraform destroy -auto-approve
32+ ```
Original file line number Diff line number Diff line change 1+
2+ ### Base Code Used in Video
3+
4+ > [ !IMPORTANT]
5+ > Make sure to change S3 bucket name as it needs to be unique across all AWS Accounts.
6+
7+
8+ ``` sh
9+ resource " aws_instance" " example" {
10+ ami = " ami-0e449927258d45bc4"
11+ instance_type = " t2.micro"
12+ }
13+
14+ resource " aws_s3_bucket" " example" {
15+ bucket = " kplabs-demo-s3-007"
16+ }
17+ ```
18+
19+
20+ ### Final Code
21+ ``` sh
22+ resource " aws_instance" " example" {
23+ ami = " ami-0e449927258d45bc4"
24+ instance_type = " t2.micro"
25+ depends_on = [aws_s3_bucket.example]
26+ }
27+
28+ resource " aws_s3_bucket" " example" {
29+ bucket = " kplabs-demo-s3-007"
30+ }
31+ ```
32+ ``` sh
33+ terraform apply -auto-approve
34+
35+ terraform destroy -auto-approve
36+ ```
You can’t perform that action at this time.
0 commit comments