https://github.com/dhanushnadar/iac-docker
This project showcases Infrastructure as Code (IaC) by using Terraform to spin up a sample nodejs app container, complete with validation, planning, provisioning, and cleanup workflows.
https://github.com/dhanushnadar/iac-docker
devops docker hcl nodejs terraform
Last synced: about 2 months ago
JSON representation
This project showcases Infrastructure as Code (IaC) by using Terraform to spin up a sample nodejs app container, complete with validation, planning, provisioning, and cleanup workflows.
- Host: GitHub
- URL: https://github.com/dhanushnadar/iac-docker
- Owner: DhanushNadar
- Created: 2025-04-10T12:22:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-10T13:28:51.000Z (about 1 year ago)
- Last Synced: 2025-04-10T14:51:55.108Z (about 1 year ago)
- Topics: devops, docker, hcl, nodejs, terraform
- Language: HCL
- Homepage:
- Size: 392 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# ๐ Terraform Docker Container Provisioning
This project demonstrates how to use **Terraform** to provision and manage a **Docker container** locally using **Infrastructure as Code (IaC)** principles.
---
## ๐ Objective
Provision a Docker container using Terraform on your local machine.
---
## ๐ ๏ธ Tools & Tech Stack
- **Terraform** โ IaC tool for automating infrastructure
- **Docker** โ Containerization platform
- **Local system** (Linux/macOS/Windows with Docker & Terraform installed)
---
## ๐ Project Structure

## ๐ง Prerequisites
- [Terraform Installed](https://developer.hashicorp.com/terraform/downloads)
- [Docker Installed & Running](https://docs.docker.com/get-docker/)
- Docker daemon must be running locally
---
## ๐ผ๏ธ Tf files Screenshots



## ๐ How to Run
### โ
Initialize Terraform
```bash
terraform init
```

### ๐ Validate Configuration
```bash
terraform validate
```
Checks the syntax and structure of your Terraform configuration files.

๐ Check What Will Be Created
```bash
terraform plan
```
Previews the infrastructure that Terraform will create or modify.

โ๏ธ Apply & Provision Infrastructure
```bash
terraform apply
```
Applies the Terraform configuration to create the container. Confirm with yes when prompted.

โ๏ธ State List
```bash
terraform state list
```

๐ Access the App
After provisioning is complete, you can access the app from your browser at:
```bash
http://localhost:3000
```
This is a running nginx container exposed on port 8080.
๐งผ Destroy Infrastructure
```bash
terraform destroy
```

Tears down the container and cleans up resources. Confirm with yes when prompted.
> ๐ก Made with โค๏ธ using Terraform and Docker by Dhanush Nadar!