This project demonstrates the use of Terraform to provision an AWS S3 bucket and deploy a simple static website. The infrastructure is defined as code, allowing for easy reproducibility and scalability.
The project is organized into the following files:
main.tf
: Defines the AWS S3 bucket and its configuration.providers.tf
: Specifies the required Terraform providers and versions.variables.tf
: Contains variable declarations, allowing for customization.outputs.tf
: Specifies outputs to be displayed after deployment.README.md
: Provides project documentation and usage instructions.index.html
anderror.html
: Basic HTML files for the static website.
-
Clone the Repository:
git clone https://github.com/prashant235913/Terraformproject.git cd Terraformproject
-
Update Variables (Optional):
Open
variables.tf
and update thebucketname
variable if you want to use a different S3 bucket name. -
Initialize Terraform:
terraform init
-
Apply Changes:
terraform apply -auto-approve
-
Deploy the Website:
Upload your website files (e.g.,
index.html
,error.html
) manually or use a deployment script. -
Access the Website:
After applying changes, the output will provide the website URL. Visit this URL in your web browser to view your static website.
-
Cleanup (Optional):
If needed, run the following command to destroy the created resources:
terraform destroy -auto-approve
You can find a visual representation of the project in the project_diagram.png file. Open the file using an image viewer.
This project serves as a foundational example for deploying a static website using Terraform and AWS S3. Feel free to customize and extend it based on your requirements.
For any additional questions or issues, please refer to the project documentation or contact the project maintainers.
Happy coding! 🚀