Skip to content

Commit

Permalink
Added Terraform Tasks for Day 62
Browse files Browse the repository at this point in the history
  • Loading branch information
LondheShubham153 committed Mar 4, 2023
1 parent 833a3b5 commit cb31a12
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 12 deletions.
2 changes: 1 addition & 1 deletion 2023/day58/tasks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Day 57: Ansible Playbooks
# Day 58: Ansible Playbooks

Ansible playbooks run multiple tasks, assign roles, and define configurations, deployment steps, and variables. If you’re using multiple servers, Ansible playbooks organize the steps between the assembled machines or servers and get them organized and running in the way the users need them to. Consider playbooks as the equivalent of instruction manuals.

Expand Down
2 changes: 1 addition & 1 deletion 2023/day59/tasks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Day 57: Ansible Project 🔥
# Day 59: Ansible Project 🔥

Ansible playbooks are amazing, as you learned yesterday.
What if you deploy a simple web app using ansible, sounds like a good project, right?
Expand Down
3 changes: 2 additions & 1 deletion 2023/day60/tasks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Day 58- Terraform🔥
# Day 60 - Terraform🔥
Hello Learners , you guys are doing every task by creating an ec2 instance (mostly). Today let’s automate this process . How to do it ? Well Terraform is the solution .
## What is Terraform?
Terraform is an infrastructure as code (IaC) tool that allows you to create, manage, and update infrastructure
Expand All @@ -20,5 +20,6 @@ Refer this [link](https://phoenixnap.com/kb/how-to-install-terraform) for instal
You can prepare for tomorrow's task from [here](https://www.youtube.com/live/965CaSveIEI?feature=share)🚀🚀

We Hope this tasks will help you understand how to write a basic Terraform configuration file, how to authenticate with AWS, and how to create an EC2 instance.

Don’t forget to post in on LinkedIn.
Happy Learning:)
19 changes: 10 additions & 9 deletions 2023/day61/tasks.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
Day 61- Terraform🔥
# Day 61- Terraform🔥

Hope you've already got the gist of What Working with Terraform would be like . Lets begin
with day 2 of Terraform !



Task 1:
## Task 1:
find purpose of basic Terraform commands which you'll use often

1. `terraform init`

2. `terraform init -upgrade`

3.`terraform plan`
3. `terraform plan`

4.`terraform apply`
4. `terraform apply`

5.`terraform validate`
5. `terraform validate`

6.`terraform fmt`
6. `terraform fmt`

7. `terraform destroy`



Task 2:
Create a folder and use `Terraform Init` command.
## Task 2:
Create a folder and use `terraform init` command.
- Create 2 EC2 instances(t2.micro) with Ubuntu AMI with a single terraform script .
Rest keep in default as of now.
- Use `terraform Destroy` command as you learned above and stop the EC2 instance.
- Use `terraform destroy` command as you learned above and stop the EC2 instance.



Expand All @@ -42,5 +42,6 @@ Packer
Cloud Foundry
Kubernetes

Want a Free video Course for terraform? Click [here](https://bit.ly/tws-terraform)

Don't forget to share your learnings on Linkedin ! Happy Learning :)
70 changes: 70 additions & 0 deletions 2023/day62/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Day 62 - Terraform with Docker 🔥

Terraform needs to be told which provider to be used in the automation, hence we need to give the provider name with source and version.
For Docker, we can use this block of code in your main.tf

## Blocks and Resources in Terraform

## Terraform block

## Task-01
- Create a Terraform script with Blocks and Resources

```
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "~> 2.21.0"
}
}
}
```
### Note: kreuzwerker/docker, is shorthand for registry.terraform.io/kreuzwerker/docker.

## Provider Block
The provider block configures the specified provider, in this case, docker. A provider is a plugin that Terraform uses to create and manage your resources.

```
provider "docker" {}
```

## Resource
Use resource blocks to define components of your infrastructure. A resource might be a physical or virtual component such as a Docker container, or it can be a logical resource such as a Heroku application.

Resource blocks have two strings before the block: the resource type and the resource name. In this example, the first resource type is docker_image and the name is Nginx.

## Task-02
- Create a resource Block for an nginx docker image

Hint:
```
resource "docker_image" "nginx" {
name = "nginx:latest"
keep_locally = false
}
```
- Create a resource Block for running a docker container for nginx

```
resource "docker_container" "nginx" {
image = docker_image.nginx.latest
name = "tutorial"
ports {
internal = 80
external = 80
}
}
```

Note: In case Docker is not installed

`sudo apt-get install docker.io`
`sudo docker ps`
`sudo chown $USER /var/run/docker.sock`

# Video Course

I can imagine, Terraform can be tricky, so best to use a Free video Course for terraform [here](https://bit.ly/tws-terraform)

Happy Learning :)

0 comments on commit cb31a12

Please sign in to comment.