This repository contains the Terraform configuration files to deploy and manage infrastructure on Google Cloud Platform (GCP).
Before getting started, ensure you have the following installed:
- Terraform
- gcloud CLI
- A Google Cloud account with billing enabled or Free Trial
Before applying the Terraform configuration, ensure your Google Cloud project is correctly configured via the gcloud
CLI:
-
Authenticate with Google Cloud:
gcloud auth login gcloud auth application-default login
-
List Available Projects (Optional):
gcloud projects list
-
Set the Desired Project:
gcloud config set project PROJECT_ID
-
Install
kubectl
Component (if not already installed):gcloud components install kubectl
-
Enable Required Services:
gcloud services enable compute.googleapis.com --project=PROJECT_ID gcloud services enable container.googleapis.com --project=PROJECT_ID
-
(Optional) Get Cluster Credentials for Kubernetes Access:
gcloud container clusters get-credentials ecommerce-cluster --zone europe-west1-b --project=PROJECT_ID
git clone https://github.com/Deniz1433/CS436-Term-Project.git
cd CS436-Term-Project
Create a new project in Google Cloud Console and note down your Project ID.
Create a file named terraform.tfvars
in the project root directory with the following content:
project_id = "your-project-id"
mysql_root_password = "your-mysql-root-password"
db_host = "your-db-host"
db_user = "your-db-user"
db_password = "your-db-password"
db_name = "your-db-name"
session_secret = "your-session-secret"
node_env = "your-node-env"
mailgun_api_key = "your-mailgun-api-key"
mailgun_domain = "your-mailgun-domain"
email_from = "your-email-from-address"
dangerously_disable_host_check = "true-or-false"
gmail_user = "mail-address"
gmail_pass = "application-password"
Run the following command to initialize the working directory:
terraform init
Generate and review the execution plan:
terraform plan
Deploy the infrastructure to GCP:
terraform apply
Confirm the action when prompted.
- Please make sure the files use LF instead of CRLF.
- Ensure to log in to your GCP account.
This project is licensed under the MIT License.