diff --git a/INDEX.md b/INDEX.md index d4f4f15e..d30a8633 100644 --- a/INDEX.md +++ b/INDEX.md @@ -12,7 +12,7 @@ | `aws_instance` | [aws](aws/aws_instance)

[simple](aws/aws_instance/simple)

[simple_ssh_access](aws/aws_instance/simple_ssh_access) | | `aws_lambda_function` | [aws](aws/aws_lambda_function)

[simple](aws/aws_lambda_function/simple) | | `aws_rds_cluster` | [aws](aws/aws_rds_cluster)

[simple](aws/aws_rds_cluster/simple) | -| `aws_s3_bucket` | [aws, backends, s3](backends/s3/aws_s3_bucket) | +| `aws_s3_bucket` | [aws, backends, s3](backends/s3/aws_s3_bucket)

[s3_static_website](aws/aws_s3_bucket/s3_static_website) | | `aws_security_group` | [aws, ssh](aws/aws_security_group/ssh)

[aws, open](aws/aws_security_group/open) | | `aws_vpc` | [aws](aws/aws_vpc/simple) | | `azuread_application` | [simple](azuread/azuread_application/simple) | diff --git a/aws/aws_s3_bucket/s3_static_website/destroy.sh b/aws/aws_s3_bucket/s3_static_website/destroy.sh new file mode 100755 index 00000000..0f65744a --- /dev/null +++ b/aws/aws_s3_bucket/s3_static_website/destroy.sh @@ -0,0 +1,2 @@ +#!/bin/bash +../../../bin/destroy.sh aws diff --git a/aws/aws_s3_bucket/s3_static_website/main.tf b/aws/aws_s3_bucket/s3_static_website/main.tf new file mode 100644 index 00000000..f78c7dee --- /dev/null +++ b/aws/aws_s3_bucket/s3_static_website/main.tf @@ -0,0 +1,61 @@ +# Summary: Setup a static website inside the S3 Bucket + +# Documentation: https://www.terraform.io/docs/language/settings/index.html +terraform { + required_version = ">= 1.0.0" + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.38" + } + } +} + +# Documentation: https://www.terraform.io/docs/language/providers/requirements.html +provider "aws" { + region = "us-east-1" + default_tags { + tags = { + cs_terraform_examples = "aws_s3_bucket/s3_static_website" + } + } +} + + + +# Documentation: https://www.terraform.io/docs/language/providers/requirements.html +# See also: [aws/aws_s3_bucket/simple] (https://github.com/ContainerSolutions/terraform-examples/tree/main/aws/aws_s3_bucket/simple) +# Explanation: Sets a Bucket for Static Website Hosting +# Now you have to add your files to the bucket index.html and also acces with this naming scheme , dependig on your region: +# s3-website dash (-) Region ‐ http://bucket-name.s3-website-Region.amazonaws.com +# s3-website dot (.) Region ‐ http://bucket-name.s3-website.Region.amazonaws.com + +resource "aws_s3_bucket" "changeme_aws_static_website" { + bucket = "s3-website-xftcs.example.com" + acl = "public-read" + policy = file("policy.json") + website { + index_document = "index.html" + error_document = "error.html" + + routing_rules = <