This Terraform configuration allows you to deploy a static website on Google Cloud Storage (GCS).
Before you begin, make sure you have the following installed/configured:
- Terraform
- Google Cloud SDK
- A registered domain name
- A GCP project with billing enabled
-
Clone this repository:
git clone https://github.com/Prashanna313/gcs-static-website.git
-
Navigate to the project directory:
cd terraform
-
Initialize Terraform:
terraform init
-
Configure your Terraform variables by editing
terraform.tfvars
:project_id = "your-project-id" bucket_name = "your-bucket-name"
-
Apply the Terraform configuration:
terraform apply
-
Follow the prompts to review and confirm the changes.
main.tf
: Defines the resources to be provisioned including Cloud Storage bucket.variables.tf
: Declares the input variables used in the Terraform configuration.
Once the Terraform configuration is applied successfully, your static website will be hosted on GCP Cloud Storage. You can upload your website content to the Cloud Storage bucket and access it using the configured domain name.
To destroy the provisioned resources and clean up the environment, run:
terraform destroy