diff --git a/examples/aws-s3-bucket/README.md b/examples/aws-s3-bucket/README.md deleted file mode 100644 index 35c587f..0000000 --- a/examples/aws-s3-bucket/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Terraform Module Example - -## AWS S3 Bucket - -This example demonstrates how to use the Artifact Builder Terraform module to -build and deploy a simple static website to AWS S3. - -In this example, we have a simple static website composed of HTML files. We use -the Artifact Builder module with `artifact_src_type` set to "directory" to -package the entire website directory as the artifact. This artifact is then -deployed to an AWS S3 bucket, which is configured to host a static website. - -This example is intended to show the flexibility of the Artifact Builder module -in handling different artifact types, including whole directories. It also shows -how to integrate the module with other Terraform resources to create a complete -deployment workflow. - -### Prerequisites - -- Terraform installed on your local machine -- Docker installed on your local machine -- AWS account with the necessary permissions to create Lambda functions and - IAM roles -- AWS CLI installed and configured with your AWS account diff --git a/examples/aws-s3-bucket/fixtures/website/Dockerfile b/examples/aws-s3-bucket/fixtures/website/Dockerfile deleted file mode 100644 index 7bd71f2..0000000 --- a/examples/aws-s3-bucket/fixtures/website/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM node:18 as build - -WORKDIR /opt/app - -COPY . . - -# additional build steps here (e.g. npm install) - -# ------------------------------------------------------------------ package --- - -FROM alpine:latest as package - -COPY --from=build /opt/app/assets/ /opt/app/dist/ - -RUN apk add zip \ - && cd /opt/app/dist diff --git a/examples/aws-s3-bucket/fixtures/website/assets/index.html b/examples/aws-s3-bucket/fixtures/website/assets/index.html deleted file mode 100644 index 42db73e..0000000 --- a/examples/aws-s3-bucket/fixtures/website/assets/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - My Static Website - - - -

Welcome to my static website!

-

This is a simple static website hosted on AWS S3 and deployed using a Terraform module.

- - - diff --git a/examples/aws-s3-bucket/main.tf b/examples/aws-s3-bucket/main.tf deleted file mode 100755 index e47a35e..0000000 --- a/examples/aws-s3-bucket/main.tf +++ /dev/null @@ -1,47 +0,0 @@ -locals { - mime_types = { - ".html" = "text/html" - ".css" = "text/css" - ".js" = "application/javascript" - ".json" = "application/json" - ".png" = "image/png" - ".jpg" = "image/jpeg" - ".gif" = "image/gif" - ".svg" = "image/svg+xml" - } -} - -module "artifact_packager" { - source = "../../" - - docker_build_context = "${path.module}/fixtures/website" - docker_build_target = "package" - artifact_src_type = "directory" - artifact_src_path = "/opt/app/dist/" - artifact_dst_directory = "${path.module}/dist" -} - -resource "random_string" "website_bucket_random_suffix" { - length = 6 - special = false - upper = false -} - -resource "aws_s3_bucket" "website_bucket" { - bucket = "example-tf-docker-artifact-packager-${random_string.website_bucket_random_suffix.result}" - acl = "public-read" - - website { - index_document = "index.html" - } -} - -resource "aws_s3_bucket_object" "website_files" { - for_each = fileset(module.artifact_packager.artifact_dst_directory, "**/*") - - bucket = aws_s3_bucket.website_bucket.bucket - key = each.value - source = "${module.artifact_packager.artifact_dst_directory}/${each.value}" - content_type = lookup(local.mime_types, regex("\\.[^.]+$", each.value), "binary/octet-stream") - acl = "public-read" -} diff --git a/examples/aws-s3-bucket/provider.tf b/examples/aws-s3-bucket/provider.tf deleted file mode 100755 index d8b940e..0000000 --- a/examples/aws-s3-bucket/provider.tf +++ /dev/null @@ -1,8 +0,0 @@ -# provider "aws" { -# region = "us-east-1" -# } - -provider "docker" { - - host = "unix:///var/run/docker.sock" -} diff --git a/examples/aws-s3-bucket/version.tf b/examples/aws-s3-bucket/version.tf deleted file mode 100755 index 758f8f6..0000000 --- a/examples/aws-s3-bucket/version.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - } - docker = { - source = "kreuzwerker/docker" - } - } -}