From cf4400911b4e019d601b5016f8b26ead84d4e6b8 Mon Sep 17 00:00:00 2001 From: Rishabh <125804877+MercyShark@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:53:43 +0530 Subject: [PATCH 1/7] =?UTF-8?q?Add=20exercise=20and=20solution=20for=20cre?= =?UTF-8?q?ating=20a=20custom=20VPC=20and=20subnets=20with=20=E2=80=A6=20(?= =?UTF-8?q?#10597)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add exercise and solution for creating a custom VPC and subnets with Terraform * Add exercise and solution for creating a custom VPC and subnets with Terraform --- topics/terraform/README.md | 1 + .../exercises/vpc_subnet_creation/exercise.md | 19 +++++ .../exercises/vpc_subnet_creation/solution.md | 78 +++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 topics/terraform/exercises/vpc_subnet_creation/exercise.md create mode 100644 topics/terraform/exercises/vpc_subnet_creation/solution.md diff --git a/topics/terraform/README.md b/topics/terraform/README.md index c656baa77..c1b76ccda 100644 --- a/topics/terraform/README.md +++ b/topics/terraform/README.md @@ -53,6 +53,7 @@ |--------|--------|------|----|----| | Launch EC2 instance | EC2 | [Exercise](exercises/launch_ec2_instance/exercise.md) | [Solution](exercises/launch_ec2_instance/solution.md) | | | Rename S3 bucket | S3 | [Exercise](exercises/s3_bucket_rename/exercise.md) | [Solution](exercises/s3_bucket_rename/solution.md) | | +| Create Custom VPC and Subnets | VPC | [Exercise](exercises/vpc_subnet_creation/exercise.md) | [Solution](exercises/vpc_subnet_creation/solution.md) | | ## Questions diff --git a/topics/terraform/exercises/vpc_subnet_creation/exercise.md b/topics/terraform/exercises/vpc_subnet_creation/exercise.md new file mode 100644 index 000000000..45c52520e --- /dev/null +++ b/topics/terraform/exercises/vpc_subnet_creation/exercise.md @@ -0,0 +1,19 @@ +# Creating Custom VPC and Subnets with Terraform + +## Requirements +* An existing AWS account with permissions to create VPCs and subnets. +* Terraform installed on your local machine. +* AWS CLI configured with your credentials. + + +## Objectives +1. Create a custom VPC with a specified CIDR block. + For example, you can use `10.0.0.0/16`. +2. Create two subnets within the VPC, each with a different CIDR block. + For example, you can use `10.0.0.0/20` for the first subnet and `10.0.16.0/20` for the second subnet. + + Both subnets should be in different availability zones to ensure high availability. +3. Ensure that the VPC and subnets are tracked by Terraform. + +## Solution +Click [here to view the solution](solution.md) diff --git a/topics/terraform/exercises/vpc_subnet_creation/solution.md b/topics/terraform/exercises/vpc_subnet_creation/solution.md new file mode 100644 index 000000000..1c047c14a --- /dev/null +++ b/topics/terraform/exercises/vpc_subnet_creation/solution.md @@ -0,0 +1,78 @@ +# Creating Custom VPC and Subnets with Terraform + + +## Objectives +1. Create a custom VPC with a specified CIDR block. + For example, you can use `10.0.0.0/16`. +2. Create two subnets within the VPC, each with a different CIDR block. + For example, you can use `10.0.0.0/20` for the first subnet and `10.0.16.0/20` for the second subnet. + + Both subnets should be in different availability zones to ensure high availability. +3. Ensure that the VPC and subnets are tracked by Terraform. + + +## Solution + + + +```sh +# Create a directory for the Terraform configuration +mkdir vpc_subnet_creation && cd vpc_subnet_creation +``` + +```sh +# Create the main.tf file with the VPC and subnets configuration +touch main.tf +``` + +```terraform +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + } +} + +provider "aws" { + region = "your-region" # e.g., ap-south-1 +} + +resource "aws_vpc" "my_custom_vpc" { + cidr_block = "10.0.0.0/16" + tags = { + Name = "my_custom_vpc_made_with_terraform" + } +} + +resource "aws_subnet" "Subnet_A" { + cidr_block = "10.0.0.0/20" + vpc_id = aws_vpc.my_custom_vpc.id + availability_zone = "your-availability-zone-a" # e.g., ap-south-1a + tags = { + "Name" = "Subnet A" + } +} +resource "aws_subnet" "Subnet_B" { + cidr_block = "10.0.16.0/20" + vpc_id = aws_vpc.my_custom_vpc.id + availability_zone = "your-availability-zone-b" # e.g., ap-south-1b + tags = { + "Name" = "Subnet B" + } +} +``` + +```sh +# Initialize Terraform to download the AWS provider +terraform init +``` + +```sh +# Apply the Terraform configuration to create the VPC and subnets +terraform apply -auto-approve +``` + + + From 3d30c2c0e3f09691d2af96bb7e315b54ef68923a Mon Sep 17 00:00:00 2001 From: Mohit Pant <168906022+mohitpant1010@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:54:08 +0530 Subject: [PATCH 2/7] Added diff -r command example and explanation in directories_comparison.md (#10596) --- .../shell/solutions/directories_comparision.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 exercises/shell/solutions/directories_comparision.md diff --git a/exercises/shell/solutions/directories_comparision.md b/exercises/shell/solutions/directories_comparision.md new file mode 100644 index 000000000..c94d04766 --- /dev/null +++ b/exercises/shell/solutions/directories_comparision.md @@ -0,0 +1,13 @@ +## How to compare two directories in Linux? + +You can use the 'diff' command with the '-r' flag to compare two direcotries recursively. + + + +### Example: +'''bash +diff -r folder1/ folder2/ + +This command compares all the files and subdirectories inside 'folder1' and 'folder2'. +If both directories have identical contents, it retuns nothing. +If there are differences,it showss which files differ or are missing. From abc00799044989b246596db7aadb5f1ac2e37441 Mon Sep 17 00:00:00 2001 From: tdurkut Date: Thu, 7 Aug 2025 20:25:17 +0300 Subject: [PATCH 3/7] Update title Fork 102 for clarity (#10591) --- topics/os/fork_102.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topics/os/fork_102.md b/topics/os/fork_102.md index c41dd6df0..084c664a5 100644 --- a/topics/os/fork_102.md +++ b/topics/os/fork_102.md @@ -1,4 +1,4 @@ -## Fork 101 +## Fork 102 Answer the questions given the following program (without running it): From 83e30cc021341dda4e6e50545c3e33dbcb59bbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20G=C3=B6zl=C3=BC?= <75528635+odd509@users.noreply.github.com> Date: Thu, 7 Aug 2025 20:25:37 +0300 Subject: [PATCH 4/7] Update README.md (#10589) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f996f96bf..2fc08ae75 100644 --- a/README.md +++ b/README.md @@ -1119,7 +1119,7 @@ With var x int = 2 we are setting the variable type to integer whil
True or False? In Go we can redeclare variables and once declared we must use it. -False. We can't redeclare variables but yes, we must used declared variables. +False. We can't redeclare variables but yes, we must use declared variables.
From 5cfd044135dba933fd5644dcc99b392950c2932b Mon Sep 17 00:00:00 2001 From: Bryson Tai Date: Fri, 8 Aug 2025 01:26:00 +0800 Subject: [PATCH 5/7] Correct solution.md (#10587) --- topics/argo/exercises/secrets_101/{soltuion.md => solution.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename topics/argo/exercises/secrets_101/{soltuion.md => solution.md} (100%) diff --git a/topics/argo/exercises/secrets_101/soltuion.md b/topics/argo/exercises/secrets_101/solution.md similarity index 100% rename from topics/argo/exercises/secrets_101/soltuion.md rename to topics/argo/exercises/secrets_101/solution.md From be401b71b55082a33baf62ada858e4e67418ac03 Mon Sep 17 00:00:00 2001 From: Shubham Machal Date: Thu, 7 Aug 2025 10:27:04 -0700 Subject: [PATCH 6/7] added a variable question (#10585) * added a variable question * added a disaster recovery question in AWS * added a backend question * added questions on manual config vs IaC * Update topics/terraform/README.md Co-authored-by: andrzejsydor --------- Co-authored-by: andrzejsydor --- topics/aws/README.md | 5 +++++ topics/terraform/README.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/topics/aws/README.md b/topics/aws/README.md index d8d9ce2e2..148578625 100644 --- a/topics/aws/README.md +++ b/topics/aws/README.md @@ -1688,6 +1688,11 @@ True A transport solution which was designed for transferring large amounts of data (petabyte-scale) into and out the AWS cloud.
+
+ How can a company ensure their web application continues to operate if it becomes unavailable in its current single region?
+Deploy the application in multiple Regions. Use Amazon Route 53 DNS health checks to route traffic to a healthy Region +
+ ### ELB
diff --git a/topics/terraform/README.md b/topics/terraform/README.md index c1b76ccda..9457d117c 100644 --- a/topics/terraform/README.md +++ b/topics/terraform/README.md @@ -75,6 +75,17 @@ -
+
+What is one reason why manual processes can be helpful?
+For learning a platform when first starting out +
+ +
+Why is it advisable to avoid using manual processes when creating infrastructure at scale? +Manual processes for creating infrastructure are slow because they require human intervention for each step, which delays deployment. They are error-prone since manual configuration increases the risk of mistakes and inconsistencies. Additionally, these processes are not easily repeatable, making it difficult to ensure the same infrastructure setup across different environments—unlike Infrastructure as Code (IaC), which automates and standardizes deployments. +
+ +
What are some of Terraform features?
@@ -402,6 +413,18 @@ If no value given, user will be prompted to provide one. Using the syntax `var.`
+
+[Question] You are configuring a variable for your Terraform configuration. Which arguments are required when configuring a `variable` block? 1. `type` and `description` 2. There are no required arguments 3. `type` 4. `type`, `description` and `default` + +[Answer] 2. There are no required arguments + +In Terraform, when declaring a variable block, there are no mandatory arguments. You can create a variable with an empty block like: + +variable "example" {} + +While `type`, `description`, and `default` are commonly used, they're all optional. The `type` argument helps with validation, `description` documents the variable's purpose, and `default` provides a fallback value if none is specified. +
+
What is the effect of setting variable as "sensitive"?
@@ -947,6 +970,13 @@ You can use it the following syntax `data.terraform_remote_state..outputs.
+
+How does a remote state backend improve collaboration for a Terraform project?
+ +By storing the state file in a shared location enabling multiple people or processes to work with the same state. +A remote state backend improves collaboration on Terraform projects by addressing the core challenge of sharing infrastructure state. When a team works on infrastructure, everyone needs access to the current state to safely make changes. +
+ #### Workspaces
From c9abddfe7c5a52a20bc295b8fdb453cc95c90594 Mon Sep 17 00:00:00 2001 From: Alex Barth Date: Thu, 7 Aug 2025 19:27:38 +0200 Subject: [PATCH 7/7] Update README.md (#10583) Remove nested use of and triple backticks. --- topics/git/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/topics/git/README.md b/topics/git/README.md index 3beb8a983..99d4e403d 100644 --- a/topics/git/README.md +++ b/topics/git/README.md @@ -139,14 +139,13 @@ True
You have two branches - main and devel. How do you make sure devel is in sync with main?
- + ``` git checkout main git pull git checkout devel git merge main ``` -