{"id":26009997,"url":"https://github.com/byu-oit/hw-static-site","last_synced_at":"2026-02-03T23:32:14.243Z","repository":{"id":39637479,"uuid":"271397886","full_name":"byu-oit/hw-static-site","owner":"byu-oit","description":"Template for creating a product specific repo with terraform files for deployment","archived":false,"fork":false,"pushed_at":"2025-09-05T02:13:25.000Z","size":303,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":21,"default_branch":"prd","last_synced_at":"2025-09-05T04:11:18.226Z","etag":null,"topics":["devops","template"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byu-oit.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-06-10T22:23:11.000Z","updated_at":"2025-09-05T02:13:27.000Z","dependencies_parsed_at":"2023-02-17T22:31:27.854Z","dependency_job_id":"e8e9ed02-d3a1-4e1d-8f58-3567da481ccf","html_url":"https://github.com/byu-oit/hw-static-site","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/byu-oit/hw-static-site","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fhw-static-site","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fhw-static-site/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fhw-static-site/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fhw-static-site/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byu-oit","download_url":"https://codeload.github.com/byu-oit/hw-static-site/tar.gz/refs/heads/prd","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fhw-static-site/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29061540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"last_error":"SSL_read: 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":["devops","template"],"created_at":"2025-03-05T22:26:48.385Z","updated_at":"2026-02-03T23:32:14.226Z","avatar_url":"https://github.com/byu-oit.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hw-static-site\nExample of creating and deploying a Static Website with S3 and Terraform on AWS.\n\n## Prerequisites\n\n* Install [Terraform](https://www.terraform.io/downloads.html)\n* Ensure your account has a [Terraform State S3 Backend](https://github.com/byu-oit/terraform-aws-backend-s3) deployed.\n\n## Setup\n* Create a new repo [using this template](https://github.com/byu-oit/hw-static-site/generate).\n\n  You need your own repo so that you can push changes and have GitHub Actions deploy them.\n  \n  Keep your repo name relatively short. Since we're creating AWS resources based off the name, we've seen [issues with repo names longer than about 24 characters](https://github.com/byu-oit/hello-world-api/issues/22).\n\n* Clone your new repo\n```\ngit clone https://github.com/byu-oit/my-new-repo\n```\n* Check out the `dev` branch \n```\ncd my-new-repo\ngit checkout -b dev\n```\n* Find and replace across the repo:\n  * replace `977306314792` with your dev AWS account number\n  * replace `539738229445` with your prd AWS account number\n  * replace `hw-static-site` with the name of your repo\n  * replace `byu-oit-terraform-dev` with the name of your `dev` AWS account\n  * replace `byu-oit-terraform-prd` with the name of your `prd` AWS account\n* Commit/push your changes\n```\ngit commit -am \"update template with repo specific details\" \ngit push\n```\n\n## Deployment\n\n### Deploy the \"one time setup\" resources\n\n```\ncd terraform-iac/dev/setup/\nterraform init\nterraform apply\n```\n\nThe output from this will give you the NS records for your new Hosted Zone. These NS records need to be entered into the DNS system of record for the parent domain.\n\nFor example, if your site's URL was `mysite-dev.byu.edu`, you would need to add the following records to QIP (as QIP is the DNS system of record for `byu.edu`):\n\n```\nmysite-dev.byu.edu NS ns-1486.awsdns-57.org\nmysite-dev.byu.edu NS ns-1853.awsdns-39.co.uk\nmysite-dev.byu.edu NS ns-829.awsdns-39.net\nmysite-dev.byu.edu NS ns-91.awsdns-11.com\n```\n\n(You'll need to change the actual values based on the output from `terraform apply`)\n\nAs another example, if your site's URL was `mysite-dev.mydepartment.byu.edu`, and `mydepartment.byu.edu` was already controlled by a Route 53 Hosted Zone, you would manually add the NS records to the Hosted Zone for `mydepartment.byu.edu`.\n\nIn the AWS Console, see if you can find the resources from `setup.tf` (Route 53 Hosted Zone, IAM Role).\n\n### View the workflow run\n\nIf you look at `.github/workflows/deploy.yml`, you'll see that it is setup to run on pushes to the dev branch. Because you have already pushed to the dev branch, this workflow should be running now.\n\n* In GitHub, in the Actions tab, click on the workflow run (it has the same name as the last commit message you pushed)\n* Click on the `Build and deploy Webapp to S3` job\n* Expand any of the steps to see what they are doing\n\n### View the deployed application\n\nAnytime after the `Terraform Apply` step succeeds   :\n```\ncd ../app/\nterraform init\nterraform output\n```\n\nThis will output a DNS Name. Enter this in a browser. It will probably return an error. This is because your content hasn't been uploaded yet, or the CloudFront distribution hasn't been updated.\n\nWait for the `Invalidate CloudFront cache` step to succeed, then try again.\n\nIn the AWS Console, see if you can find the other resources from `main.tf` (S3 Bucket, CloudFront Distribution).\n\n### Push a change to your application\n\nMake a small change to `index.html`. Commit and push this change to the `dev` branch.\n\n```\ngit commit -am \"try deploying a change\"\ngit push\n```\n\nIn GitHub Actions, watch the deploy steps run (you have a new push, so you'll have to go back and select the new workflow run instance and the job again). Once the `Invalidate CloudFront cache` step succeeds, hit your application in the browser and see if your change worked. If you aren't seeing the change, you may need to invalidate your browser cache as well.\n\n\u003e Note: \n\u003e\n\u003e It's always best to test your changes locally before pushing to GitHub and AWS. Testing locally will significantly increase your productivity as you won't be constantly waiting for GitHub Actions and CodeDeploy to deploy, just to discover bugs.\n\u003e\n\u003e You can either test locally inside Docker, or by pointing your browser directly at your local files.\n\n## Learn what was built\n\nBy digging through the `.tf` files, you'll see what resources are being created. You should spend some time searching through the AWS Console for each of these resources. The goal is to start making connections between the Terraform syntax and the actual AWS resources that are created.\n\nSeveral OIT created Terraform modules are used. You can look these modules up in our GitHub Organization. There you can see what resources each of these modules creates. You can look those up in the AWS Console too.\n\n### Related Modules\n\n* [Terraform AWS Domain Redirect](https://github.com/byu-oit/terraform-aws-domain-redirect)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyu-oit%2Fhw-static-site","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyu-oit%2Fhw-static-site","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyu-oit%2Fhw-static-site/lists"}