{"id":26009991,"url":"https://github.com/byu-oit/terraform-aws-domain-redirect","last_synced_at":"2026-03-09T13:40:11.227Z","repository":{"id":145999649,"uuid":"368319551","full_name":"byu-oit/terraform-aws-domain-redirect","owner":"byu-oit","description":"Terraform Module to facilitate redirecting a domain to a completely different domain with valid HTTPS certs etc.","archived":false,"fork":false,"pushed_at":"2023-10-05T15:31:11.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":21,"default_branch":"main","last_synced_at":"2024-04-14T06:10:00.923Z","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":"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}},"created_at":"2021-05-17T20:54:36.000Z","updated_at":"2024-04-14T06:10:00.924Z","dependencies_parsed_at":null,"dependency_job_id":"fd6f69ee-1cbb-48eb-b3d9-0f02febc6f52","html_url":"https://github.com/byu-oit/terraform-aws-domain-redirect","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fterraform-aws-domain-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fterraform-aws-domain-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fterraform-aws-domain-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fterraform-aws-domain-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byu-oit","download_url":"https://codeload.github.com/byu-oit/terraform-aws-domain-redirect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242112782,"owners_count":20073669,"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":"2025-03-05T22:26:47.579Z","updated_at":"2025-12-04T14:04:33.320Z","avatar_url":"https://github.com/byu-oit.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Latest GitHub Release](https://img.shields.io/github/v/release/byu-oit/terraform-aws-domain-redirect?sort=semver)\n\n# Terraform AWS Domain Redirect\nThis module manages all the AWS resources needed to provide the ability to redirect traffic for a domain to a different URL.\n\nUnfortunately redirecting to a completely different domain is more complex than one would think.\nSee [architecture](#architecture).\n\n#### [New to Terraform Modules at BYU?](https://github.com/byu-oit/terraform-documentation)\n\n## Usage\n```hcl\nmodule \"domain_redirect\" {\n  source                  = \"github.com/byu-oit/terraform-aws-domain-redirect?ref=v1.0.1\"\n  source_hosted_zone_name = \"extradomain.byu.edu\"\n  target_url              = \"newdomain.byu.edu\"\n  providers = {\n    aws.us-east-1 = aws.us-east-1\n  }\n}\n```\n\nThis module is especially useful if you want to keep an old domain but want traffic to literally redirect to a new URL instead of just serving the content to the old domain.\n\n## Requirements\n* Terraform version 0.15.0 or greater\n* Route53 Hosted Zone (`source_hosted_zone_name`) already created and DNS traffic sent to it\n* us-east-1 region AWS provider needs to be passed into the module\n\n*Note*: Terraform 0.15 is required because the module needs the us-east-1 provider because CloudFront still needs to place its SSL certificate in us-east-1.\n\n## Inputs\n| Name | Type  | Description | Default |\n| --- | --- | --- | --- |\n| source_hosted_zone_name | string | The source domain (name of the Route53 Hosted Zone) that will be redirected to target_url | |\n| source_hosted_zone_sub_domains | set(string) | A list of sub domains in the source_hosted_zone_name that you also want to redirect to the target_url (optional) | [] |\n| target_url | string | Where you want traffic to be redirected to | |\n| redirect_bucket_name | string | Name of the s3 redirect bucket (optional) | \u003csource_hosted_zone_name\u003e-redirect|\n| tags | map(string) | A map of AWS Tags to attach to each resource created (optional) | {} |\n| providers.aws.us-east-1 | terraform provider | The us-east-1 AWS provider | |\n\n## Outputs\n| Name | Type | Description |\n| ---  | ---  | --- |\n| redirect_bucket | [object](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket#attributes-reference) | The static s3 site that redirects traffic to the `target_url` |\n| redirect_cloudfront_distribution | [object](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution#attributes-reference) | The CloudFront Distribution that handles SSL to the `redirect_bucket` |\n\n## Architecture\n\nThis module creates/manages these resources:\n\n* Route53 A Records (for `source_hosted_zone_name` and any provided `source_hosted_zone_sub_domains`)\n* SSL Certificate (validated)\n* CloudFront Distribution\n* S3 Static Site (set to redirect all traffic to `target_url`)\n\n\nHow this works...\n\n1. Client attempts to reach `source_hosted_zone_name` URL\n2. Goes to Route53 Hosted Zone\n3. A records send traffic to CloudFront Distribution\n4. CloudfrontDistribution sends to S3 Static Site\n5. S3 Static Site redirects client to `target_url`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyu-oit%2Fterraform-aws-domain-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyu-oit%2Fterraform-aws-domain-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyu-oit%2Fterraform-aws-domain-redirect/lists"}