{"id":20901546,"url":"https://github.com/willfarrell/terraform-public-static-assets-module","last_synced_at":"2025-12-25T09:03:51.211Z","repository":{"id":142528799,"uuid":"114479507","full_name":"willfarrell/terraform-public-static-assets-module","owner":"willfarrell","description":"Terraform Module: CloudFront, ACM, S3","archived":false,"fork":false,"pushed_at":"2025-02-04T16:33:27.000Z","size":140,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T17:33:43.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willfarrell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-16T17:47:54.000Z","updated_at":"2025-02-04T16:32:55.000Z","dependencies_parsed_at":"2025-02-04T17:36:12.945Z","dependency_job_id":null,"html_url":"https://github.com/willfarrell/terraform-public-static-assets-module","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fterraform-public-static-assets-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fterraform-public-static-assets-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fterraform-public-static-assets-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fterraform-public-static-assets-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willfarrell","download_url":"https://codeload.github.com/willfarrell/terraform-public-static-assets-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243292833,"owners_count":20268126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T11:35:55.297Z","updated_at":"2025-12-25T09:03:46.179Z","avatar_url":"https://github.com/willfarrell.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform App Endpoint\nCreates CloudFront (w/ WAF and Lambda) and S3 Bucket.\n\n## Setup\n### Requirements\n\n- Edge provider in the root.\n\n```hcl-terraform\nprovider \"aws\" {\n    profile = \"${local.workspace[\"profile\"]}-${local.workspace[\"env\"]}\"\n    region  = \"us-east-1\"\n    alias   = \"edge\"\n}\n\n```\n\n-  ACM Certificate\n\n```hcl-terraform\ndata \"aws_acm_certificate\" \"main\" {\n  provider = \"aws.edge\"\n  domain   = \"${var.env}-appname.example.com\"\n  statuses = [\"ISSUED\"]\n}\n```\n\n- Web Application Firewall (Optional)\n\n```hcl-terraform\nmodule \"waf\" {\n  source = \"git@github.com:willfarrell/terraform-waf-module\"\n  name   = \"${local.workspace[\"name\"]}\"\n  defaultAction = \"ALLOW\"\n  providers = {\n    aws = \"aws.edge\"\n  }\n}\n```\n\n### Module\n```hcl-terraform\n\nmodule \"logs\" {\n  source = \"git@github.com:willfarrell/terraform-s3-logs-module?ref=v0.3.0\"\n  name   = \"${local.workspace[\"name\"]}-${terraform.workspace}-edge\"\n  tags   = {\n    \"Name\": \"Edge Logs\"\n  }\n}\n\nmodule \"app\" {\n  source              = \"git@github.com:willfarrell/terraform-public-static-assets?ref=v0.2.1\"\n\n  name                = \"${var.env}-myapp\"\n  aliases             = [\"${var.env != \"prod\" ? \"${var.env}-\": \"\"}appname.example.com\"]\n  acm_certificate_arn = data.aws_acm_certificate.main.arn\n  web_acl_id          = module.waf.id\n  lambda = {\n    \"origin-request\" = file(\"${path.module}/origin-request.js\")\n    \"viewer-request\" = file(\"${path.module}/viewer-request.js\")\n    \"viewer-response\" = file(\"${path.module}/viewer-response.js\")\n    \"origin-response\" = file(\"${path.module}/origin-response.js\")\n  }\n  error_codes      = { \n    404 = \"/404.html\"\n  }\n  logging_bucket         = \"${local[terraform.workspace].name}-${terraform.workspace}-edge-logs\"\n  \n  providers = {\n    aws = \"aws.edge\"\n  }\n}\n```\n\n## Input\n- **name:** AWS S3 Bucket name. `${var.env}-${var.name}`.\n- **aliases:** CloudFront Aliases.\n- **acm_certificate_arn:** Domain Certificate ARN\n- **web_acl_id:** WAF ACL ID\n- **lambda:** lambda@Edge functions\n- **cors_origins:** URL to apply to CORS. [Default: `[\"*\"]`]\n- **error_codes:** map of paths for error codes. Defaults: none\n- **logging_bucket:** Bucket id for where teh logs should be sent\n\n## Output\n- **bucket:** `${aws_s3_bucket.main.id}` Full name of the S3 bucket.\n- **id:** `${aws_cloudfront_distribution.main.id}` CloudFront Distribution Id for CI/CD to trigger cache clearing (`aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DISTRIBUTION_ID} --paths /index.html`)\n- **domain_name:** `${aws_cloudfront_distribution.main.domain_name}` CloudFront Domain Name for DNS updating.\n- **hosted_zone_id:** `${aws_cloudfront_distribution.main.hosted_zone_id}` CloudFront Hosted Zone ID.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillfarrell%2Fterraform-public-static-assets-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillfarrell%2Fterraform-public-static-assets-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillfarrell%2Fterraform-public-static-assets-module/lists"}