This repository contains the code and configuration files for deploying a simple Cloud Run application on Google Cloud Platform (GCP) using Terraform. The application returns a simple message when accessed via its URL.
- Prerequisites
- Architecture
- Getting Started
- Configuration
- Deployment
- Usage
- Cleanup
- Contributing
- License
Before you begin, ensure you have the following:
- A GCP account
- Google Cloud SDK installed and configured
- Terraform installed
- Docker installed for building the application image
This setup involves the following components:
- Cloud Run Service: The application is deployed as a containerized service on Cloud Run.
- Container Registry: The Docker image for the application is stored in Google Container Registry (GCR).
- Terraform Configuration: Terraform scripts are used to automate the deployment process.
git clone https://github.com/braianmobiledev/SoftwareDevelopmentGoodPractices.git# Build image
docker build -t clientes:<tag> .
# Add tag for GCR
docker tag clientes:06062024 us-central1-docker.pkg.dev/devopsterraform-425615/devops-artifacts/clientes-api:<tag>
# Push to registry
docker push us-central1-docker.pkg.dev/devopsterraform-425615/devops-artifacts/clientes-api:<tag>After successfully pushing image into registry and authenticate in gcloud CLI in your local machine you can proceed to create application
# Init modules
terraform init
# View changes to be applies
terraform plan
# Apply those changes in GCP cloud
terraform apply
# Optional
# Destroy resources
terraform destroy