{"id":19854648,"url":"https://github.com/obytes/terraform-aws-s3-ci","last_synced_at":"2026-03-04T12:32:26.401Z","repository":{"id":77139392,"uuid":"436964826","full_name":"obytes/terraform-aws-s3-ci","owner":"obytes","description":"Reusable Terraform modules for continuous integration of static web applications deployed on S3 and served by Cloudfront.","archived":false,"fork":false,"pushed_at":"2021-12-12T16:48:09.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-02-28T23:37:17.894Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/obytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-12-10T12:05:30.000Z","updated_at":"2021-12-12T16:48:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"facc27bc-c0d7-492f-a775-fea6d60fe215","html_url":"https://github.com/obytes/terraform-aws-s3-ci","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/obytes/terraform-aws-s3-ci","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-s3-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-s3-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-s3-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-s3-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obytes","download_url":"https://codeload.github.com/obytes/terraform-aws-s3-ci/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-s3-ci/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30079744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T12:28:08.313Z","status":"ssl_error","status_checked_at":"2026-03-04T12:27:28.210Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-12T14:10:02.872Z","updated_at":"2026-03-04T12:32:26.361Z","avatar_url":"https://github.com/obytes.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform AWS S3 CI\n\nReusable Terraform modules for continuous integration of static web applications deployed on s3 and served by cloudfront.\n\n## Components\n\n- **Release CI**: CI/CD pipeline to deploy static web applications to S3 Bucket.\n\n- **Preview CI**: CD/CD build to deploy static web application feature branches to a preview S3 Bucket.\n\n## Features\n\n✅ Support for mono repositories, by providing the ability to change the base directory using `app_base_dir` variable.\n\n✅ Supports any package manager, you only need to specify the installation command to use for fetching dependencies, \ni.e. `yarn install` or `npm install` using the Terraform variable `app_install_cmd`\n\n✅ Ability to change the build command using the Terraform variable `app_build_cmd`.\n\n✅ Supports any static web application framework (React, Gatsby, VueJS), you only need to provide the build folder to be \ndeployed using the `app_build_dir`, for example `build` for react and `public` for gatsby.\n\n✅ Ability to change the runtime node version using the `app_node_version` Terraform variable.\n\n✅ Trigger the release pipeline based on pushes to Github branches or based on tag publish events by setting the \nTerraform variable `pre_release` to `false` or `true`.\n\n✅ Support custom DOT ENV variables by leveraging AWS Secrets Manager. the pipeline will output `envs_sm_id` that you \ncan use to update the secrets' manager secret version.\n\n✅ On each `started`, `succeeded` and `failed` event, the pipeline can send notifications to the target Slack channels \nprovided by `ci_notifications_slack_channels` Terraform variable.\n\n✅ To improve the performance of the builds and speed up the subsequent runs, the pipeline can cache the node modules to\na remote S3 artifacts bucket `s3_artifacts` at the end of the builds and pull the cached node modules at the start of\neach build.\n\n✅ After a successful deployment, the pipeline will use the `cloudfront_distribution_id` to invalidate the old web\napplication files from the edge cache. The next time a viewer requests the web application, CloudFront returns to the\norigin to fetch the latest version of the application.\n\n✅ Notify the preview build completion and the preview URL to Github users by commenting on the target PR that triggered \nthe Build. \n\n## Usage\n\n- Preview CI Build\n\n```hcl\nmodule \"webapp_preview_ci\" {\n  source      = \"git::https://github.com/obytes/terraform-aws-s3-ci//modules/webapp-preview\"\n  prefix      = local.prefix\n  common_tags = local.common_tags\n\n  # Artifacts\n  s3_artifacts = {\n    arn    = aws_s3_bucket.artifacts.arn\n    bucket = aws_s3_bucket.artifacts.bucket\n  }\n\n  # Github\n  github = {\n    owner          = \"obytes\"\n    token          = \"Token used to comment on github PRs when the preview is ready!\"\n    webhook_secret = \"not-secret\"\n  }\n  pre_release     = false\n  repository_name = \"react-typescript-starter\"\n\n  # Build\n  app_base_dir     = \".\"\n  app_build_dir    = \"build\"\n  app_node_version = \"latest\"\n  app_install_cmd  = \"yarn install\"\n  app_build_cmd    = \"yarn build\"\n\n  # Web \u0026 Cloudfront (The used CDN module is here https://github.com/obytes/terraform-aws-s3-cdn)\n  s3_web                     = module.webapp_preview_cdn.s3         \n  cloudfront_distribution_id = module.webapp_preview_cdn.dist[\"id\"]\n\n  # Notification\n  ci_notifications_slack_channels = {\n    info  = \"ci-info\"\n    alert = \"ci-alert\"\n  }\n}\n\n# Better to not manage this resource with terraform \n# and let users modify secrets directly from console.\nresource \"aws_secretsmanager_secret_version\" \"webapp_preview_env_vars\" {\n  secret_id     = module.webapp_preview_ci.envs_sm_id\n  secret_string = jsonencode({\n    REACT_APP_FIREBASE_API_KEY        = \"REACT_APP_FIREBASE_API_KEY\"\n    REACT_APP_FIREBASE_PROJECT_ID     = \"REACT_APP_FIREBASE_PROJECT_ID\"\n    REACT_APP_FIREBASE_AUTH_DOMAIN    = \"REACT_APP_FIREBASE_AUTH_DOMAIN\"\n    REACT_APP_FIREBASE_MEASUREMENT_ID = \"REACT_APP_FIREBASE_MEASUREMENT_ID\"\n  })\n}\n```\n\n- Release CI Pipeline\n\n```hcl\nmodule \"webapp_release_ci\" {\n  source      = \"git::https://github.com/obytes/terraform-aws-s3-ci//modules/webapp-release\"\n  prefix      = local.prefix\n  common_tags = local.common_tags\n\n  # Artifacts\n  s3_artifacts = {\n    arn    = aws_s3_bucket.artifacts.arn\n    bucket = aws_s3_bucket.artifacts.bucket\n  }\n\n  # Github\n  github = {\n    owner          = \"obytes\"\n    webhook_secret = \"not-secret\"\n    connection_arn = \"arn:aws:codestar-connections:us-east-1:{ACCOUNT_ID}:connection/{CONNECTION_ID}\"\n  }\n  pre_release       = false\n  github_repository = {\n    name   = \"react-typescript-starter\"\n    branch = \"main\"\n  }\n\n  # Build\n  app_base_dir     = \".\"\n  app_build_dir    = \"build\"\n  app_node_version = \"latest\"\n  app_install_cmd  = \"yarn install\"\n  app_build_cmd    = \"yarn build\"\n\n  # Web \u0026 Cloudfront (The used CDN module is here https://github.com/obytes/terraform-aws-s3-cdn)\n  s3_web                     = module.webapp_main_cdn.s3         \n  cloudfront_distribution_id = module.webapp_main_cdn.dist[\"id\"]\n\n  # Notification\n  ci_notifications_slack_channels = {\n    info  = \"ci-info\"\n    alert = \"ci-alert\"\n  }\n}\n\n# Better to not manage this resource with terraform \n# and let users modify secrets directly from console.\nresource \"aws_secretsmanager_secret_version\" \"webapp_release_env_vars\" {\n  secret_id     = module.webapp_release_ci.envs_sm_id\n  secret_string = jsonencode({\n    REACT_APP_FIREBASE_API_KEY        = \"REACT_APP_FIREBASE_API_KEY\"\n    REACT_APP_FIREBASE_PROJECT_ID     = \"REACT_APP_FIREBASE_PROJECT_ID\"\n    REACT_APP_FIREBASE_AUTH_DOMAIN    = \"REACT_APP_FIREBASE_AUTH_DOMAIN\"\n    REACT_APP_FIREBASE_MEASUREMENT_ID = \"REACT_APP_FIREBASE_MEASUREMENT_ID\"\n  })\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-s3-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobytes%2Fterraform-aws-s3-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-s3-ci/lists"}