An open API service indexing awesome lists of open source software.

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.

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

![Project-structure Screenshot](images/project-structure.png)

## ๐Ÿ”ง 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

![providerstf Screenshot](images/providerstf.png)
![main tf Screenshot](images/maintf.png)
![main page Screenshot](images/main.png)

## ๐Ÿš€ How to Run

### โœ… Initialize Terraform

```bash
terraform init
```

![init Screenshot](images/init.png)

### ๐Ÿ” Validate Configuration

```bash
terraform validate
```
Checks the syntax and structure of your Terraform configuration files.

![validate Screenshot](images/validate.png)

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

![plan Screenshot](images/plan.png)

โš™๏ธ Apply & Provision Infrastructure

```bash
terraform apply
```
Applies the Terraform configuration to create the container. Confirm with yes when prompted.

![apply Screenshot](images/apply.png)

โš™๏ธ State List

```bash
terraform state list
```

![state Screenshot](images/state.png)

๐ŸŒ 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
```

![destroy Screenshot](images/destroy.png)

Tears down the container and cleans up resources. Confirm with yes when prompted.

> ๐Ÿ’ก Made with โค๏ธ using Terraform and Docker by Dhanush Nadar!