{"id":20334937,"url":"https://github.com/mdb/terraform-example","last_synced_at":"2025-04-11T21:51:27.201Z","repository":{"id":137137961,"uuid":"57341887","full_name":"mdb/terraform-example","owner":"mdb","description":"Terraform-orchestrated continuous delivery from TravisCI","archived":false,"fork":false,"pushed_at":"2018-01-22T22:54:40.000Z","size":4328,"stargazers_count":27,"open_issues_count":0,"forks_count":27,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T17:49:30.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CSS","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/mdb.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":"2016-04-29T00:08:46.000Z","updated_at":"2024-12-27T15:41:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc3ed71c-bcd1-4d37-9115-95c17d06ffc3","html_url":"https://github.com/mdb/terraform-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fterraform-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fterraform-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fterraform-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fterraform-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdb","download_url":"https://codeload.github.com/mdb/terraform-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"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-14T20:38:37.655Z","updated_at":"2025-04-11T21:51:27.181Z","avatar_url":"https://github.com/mdb.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/mdb/terraform-example.svg?branch=master)](https://travis-ci.org/mdb/terraform-example)\n\n# terraform-example\n\nA reference repo demonstrating how to continuously deploy via [terraform](http://terraform.io)\nfrom [TravisCI](https://travis-ci.org/mdb/terraform-example).\n\nVia TravisCI (or locally), use Node.js to compile a static website; use Terraform to:\n\n* create `www.your-domain.com` and `your-domain.com` AWS S3 buckets configured for static website hosting\n* redirect requests to the `www.your-domain.com` bucket to `your-domain.com`\n* deploy the `index.html` and `error.html` objects to the `your-domain.com` bucket\n* establish an AWS Route53 `your-domain.com` DNS zone\n* establish a Route53 A record set pointing `your-domain.com` to the `your-domain.com` S3 bucket\n\n## TravisCI build flow\n\nTravisCI:\n\n1. Uses Node.js to compile `src` to a static website.\n2. If the branch is `master`, installs `terraform`\n3. If the branch is `master`, executes `deploy.sh` to deploy the static website to AWS S3 website fronted by `mikeball.me` via:\n  1. `terraform plan`\n  2. `terraform apply`\n  3. commit `terraform.tfstate` back to this repo with a `[ci skip]` commit message such that a TravisCI build is not triggered.\n\n## Giving it a spin\n\nTo deploy your own:\n\n1. Fork this repo.\n\n2. Visit [travis-ci.org](https://travis-ci.org/profile); activate CI for your fork of this repo.\n\n3. Install the `travis` CLI if you don't already have it:\n\n  ```\n  $ gem install travis\n  ```\n\n3. Use the `travis` CLI to encrypt your AWS credentials and your [Github access token]() in environment variables:\n\n  ```\n  $ travis encrypt AWS_ACCESS_KEY_ID=123 AWS_SECRET_ACCESS_KEY=456 GH_TOKEN=123\n  ```\n\n4. Add the encrypted credentials string to your `.travis.yml`, replacing the current `secure` value:\n\n  ```\n  ...\n    env:\n      secure: \"ENCRYPTED STRING HERE\"\n  ...\n  ```\n\n5. Replace `GH_USER_NAME`, `GH_USER_EMAIL`, and `GH_REPO` in the `.travis.yml` with your details.\n\n6. Replace the `domain` var in [`terraform/main.tf`](https://github.com/mdb/terraform-example/blob/master/terraform/main.tf#L6) with your domain name.\n\n7. Remove my `tfstate` files to start fresh:\n\n  ```\n  $ git rm terraform/terraform.tfstate*\n  $ git commit -m 'removed mdb tfstate'\n  ```\n\n8. Push \u0026 deploy:\n\n  ```\n  $ git push origin master\n  ```\n\n9. Note that you may need to point the DNS servers associated with `your-domain.com` to those dynamically assigned to\nyour A record by AWS. For example, my A record [uses these DNS servers](https://github.com/mdb/terraform-example/blob/master/terraform/terraform.tfstate#L48).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdb%2Fterraform-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdb%2Fterraform-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdb%2Fterraform-example/lists"}