Skip to content

bewestphal/terraform-cloudflare-s3-website

Repository files navigation

Terraform S3 Static Site with Cloudflare

Host a static website on S3 with Cloudflare DNS. Supports SSL. Great for single page apps.

Setup and deployment is as simple as a single command.

Example (React)

  1. Install Terraform
  2. Install the AWS CLI
  3. Install JQ
  4. Obtain a Cloudflare API Key
  5. Clone the Repo
    git clone https://github.com/bewestphal/terraform-cloudflare-s3-website.git
  6. Populate the .env file with required config
  7. Create React App (the demo Single Page App)
    npx create-react-app client
  8. Init terraform
    terraform init
  9. Apply terraform
    terraform apply
  10. Your website will be available at .env.DOMAIN in a few minutes!

To deploy changes to the React App just reapply Terraform
terraform apply

Importing Existing Resources

An example script terraform_import.sh provides some examples to import existing resources such as an existing cloudflare zone.

See the terraform documentation on each resource type for instructions on importing more types.

About

A demo of creating an s3 static site with cloudflare DNS. (with SSL)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published