#Assignment1
Terraform project where I run commands manually here What this project does
- Creates a Docker volume using the user_name variable
- Creates a Docker network using the custom_network variable
- Creates a Docker container using the base_image
- Maps internal container port to host port
- Mounts the created volume inside /data in the container
- Outputs the container's IP address
#Providers Used
kreuzwerker/docker — Manage Docker resources like containers, volumes, and networks. hashicorp/random — Generate random suffixes for unique container names.
Here i follow the below steps
- terraform init - Initialize terraform and it downloads the required providers.
- terraform plan - Creates a plan, this shows what resources Terraform will create.
- terraform apply - Apply the plan, need to approve by giving 'yes'. It actually creates the Docker resources.
Outputs After a deployment, Terraform will output: container_ip — The IP address of the running Docker container inside the custom network
#Assignment2
Here I have used bash script to automate the resource creation using run_terraform.sh script
to run the script chmod +x run_terraform.sh ./run_terraform.sh
This script does: terraform init terraform plan -var-file="terraform.tfvars" terraform apply
#cleanup terraform destroy -var-file="terraform.tfvars"