This Terraform configuration defines the infrastructure to create an AWS S3 bucket with versioning enabled and the ability to host a static website. It also uploads specified files to the S3 bucket.
Before you begin, ensure you have the following:
- Terraform installed on your local machine.
- AWS credentials configured with the necessary permissions to create resources.
The main.tf
file contains the main Terraform configuration for creating the AWS S3 bucket and configuring it. Here's an overview of what it does:
- Creates an AWS S3 bucket named "UniqueBucketName."
- Enables versioning for the S3 bucket.
- Configures the bucket to host a static website with "greetingPage.html" as the index document.
- Adds tags to the S3 bucket for identification.
The providers.tf
file specifies the required Terraform provider and its configuration. In this case, it configures the AWS provider with the "eu-central-1" region.
The terraform.tfvars
file is used to set input variables for your Terraform configuration. It defines the list of files to upload to the S3 bucket.
-
Clone this repository to your local machine:
git clone https://github.com/GiorgosIlia/S3Bucket.git
-
Change into the project directory:
cd S3Bucket
-
Initialize the Terraform working directory:
terraform init
-
Review and adjust the configuration files if necessary (
main.tf
,providers.tf
, andterraform.tfvars
). -
Apply the Terraform configuration to create the AWS resources:
terraform apply
-
When prompted, confirm the changes by typing "yes."
-
Terraform will create the AWS S3 bucket and upload the specified files.
To destroy the AWS resources created by this Terraform configuration, run the following command:
terraform destroy
You can customize the list of files to upload to the S3 bucket by editing the terraform.tfvars
file.
This Terraform configuration is provided under the MIT License.