- Becerra Díaz Alejandro
- González Hernández Juan Pablo
- Núñez Guerrero Melanie Guadalupe
- Peña Bravo María Cecilia
- Trujillo Ramírez César Andrés
Frausto Ramírez Juan de Dios
11/12/2024
Software Engineering and Computational Systems - 712
- Introduction
- Prerequisites
- Infrastructure Overview
- Variables
- Usage
- Commands
- Directory Structure
- Troubleshooting
- Contributing
The Fashion Finder Infrastructure repository is a Terraform-based solution to deploy the backend infrastructure required for the Fashion Finder application. The deployment includes Azure Virtual Machines, Virtual Networks, Subnets, Network Security Groups, and more.
- Terraform v1.3.7+
- Azure CLI (
az
) configured and authenticated. - Azure subscription with appropriate permissions.
- SSH keys generated for VM access.
- Docker installed locally to validate configurations.
This repository provisions the following resources in Azure:
- Virtual Network (VNet): Connects all components securely.
- Subnet: Segments network traffic for the virtual machine.
- Network Security Group (NSG): Ensures controlled traffic flow.
- Virtual Machine: Hosts the Dockerized backend application.
- Public IP Address: Provides external access to the application.
Variable | Description |
---|---|
RESOURCE_GROUP |
Name of the Azure Resource Group. |
LOCATION |
Azure region for deployment. |
ENVIRONMENT |
Deployment environment (dev , staging , prod ). |
VNET_NAME |
Name of the Virtual Network. |
SUBNET_NAME |
Name of the Subnet. |
SECURITY_GROUP_NAME |
Name of the Network Security Group. |
IP_NAME |
Name of the Public IP. |
NIC_NAME |
Name of the Network Interface. |
SERVER_NAME |
Name of the Virtual Machine. |
PORT |
Application listening port (e.g., 3000 ). |
MONGODB_URI |
MongoDB connection string. |
MONGO_INITDB_ROOT_USERNAME |
MongoDB root username. |
MONGO_INITDB_ROOT_PASSWORD |
MongoDB root password. |
EMAIL_SERVICE |
Email service provider (e.g., gmail ). |
EMAIL_USER |
Email user account. |
EMAIL_PASS |
Email access token. |
ADMIN_USERNAME |
Admin username for the VM. |
SSH_KEY_PATH |
Path to the SSH private key. |
git clone https://github.com/CeciliaCode/fashion-finder-infrastructure.git
cd fashion-finder-infrastructure
Create a terraform.tfvars
file in the root directory.
Run the following command to initialize the working directory:
terraform init
Ensure the configuration is correct:
terraform validate
View the resources to be created:
terraform plan
Deploy the infrastructure:
terraform apply
Remove all resources:
terraform destroy
Command | Description |
---|---|
terraform init |
Initialize the working directory. |
terraform validate |
Validate configuration files. |
terraform plan |
Show the execution plan. |
terraform apply |
Apply the configuration and create resources. |
terraform destroy |
Destroy all resources created by Terraform. |
.
├── env/
│ └── dev/
│ ├── main.tf # Terraform configuration file
│ ├── variables.tf # Definitions of all variables
│ └── outputs.tf # Outputs for resources
├── modules/
│ └── vm/
│ ├── main.tf # VM module configuration
│ ├── variables.tf # Module variables
│ └── outputs.tf # Module outputs
├── terraform.tfvars # Environment-specific variable values
└── README.md # Project documentation
-
Authentication Error:
- Ensure you are logged in to Azure using
az login
. - Verify the
ARM_CLIENT_ID
,ARM_CLIENT_SECRET
,ARM_TENANT_ID
, andARM_SUBSCRIPTION_ID
are correctly configured in your environment.
- Ensure you are logged in to Azure using
-
SSH Key Not Found:
- Verify the path to your SSH keys in the
SSH_KEY_PATH
variable.
- Verify the path to your SSH keys in the
-
Plan/Apply Fails:
- Ensure all required variables are defined in
terraform.tfvars
.
- Ensure all required variables are defined in