terraform-aws-static-website icon indicating copy to clipboard operation
terraform-aws-static-website copied to clipboard

Feature request - discussion

Open iongion opened this issue 3 years ago • 1 comments

Highly appreciative of this module!

This is not a bug, more like a question for those new to terraform. I want to be able to have multiple subdomains provisioned just as the main domain. Each will host its own SPA application.

The domain: fx.domain

The apps

  • main
  • app1
  • app2

Will this create the following buckets ?

  • app1.fx.domain
  • app2.fx.domain

With their log buckets, together with the main fx.domain bucket ?

provider "aws" {
  region                  = "us-east-1"
  shared_credentials_file = "~/.aws/credentials_fxdomain"
}

module "aws_static_website_main" {
  source = "cloudmaniac/static-website/aws"
  # This is the domain as defined in Route53
  domains-zone-root = "fx.domain"
  # Pretty URL support using 404 redirect to index.html
  support-spa = true
  # Domains used for CloudFront
  website-domain-main        = "fx.domain"
  website-domain-redirect    = "www.fx.domain"
  website-additional-domains = []
}

module "aws_static_website_app1" {
  source = "cloudmaniac/static-website/aws"
  domains-zone-root = "fx.domain"
  support-spa = true
  website-domain-main = "app1.fx.domain"
}

module "aws_static_website_app2" {
  source = "cloudmaniac/static-website/aws"
  domains-zone-root = "fx.domain"
  support-spa = true
  website-domain-main = "app2.fx.domain"
}

Also, do you have a recommended way to have domains and buckets for environments, such as production, staging, development ?

iongion avatar Nov 03 '22 12:11 iongion

I think we can achieve this by exposing variables and output for the website_logs bucket. Then you can reuse it from your main app. I'm curious, why do you need to reuse log buckets?

enjoy2000 avatar Jan 12 '23 08:01 enjoy2000