Skip to content

Commit

Permalink
Update providers and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Mar 31, 2022
1 parent a9b607a commit 7afabfb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@ This module is used for redirecting all requests from one or more `from` domains
// Must have Route53 zones for each domain to redirect from. Subdomains that get
// redirected can use the same zones as parent domains that get redirected.
resource "aws_route53_zone" "from_domain_1" {
name = "my-old-domain.com"
provider = aws.route53
name = "my-old-domain.com"
}
resource "aws_route53_zone" "from_domain_2" {
name = "my-other-old-domain.com"
provider = aws.route53
name = "my-other-old-domain.com"
}
module "domain_redirect" {
source = "Invicton-Labs/domain-redirect/aws"
// The provider must always be in us-east-1, since that's where CloudFront gets deployed
providers = {
aws = aws.us-east-1
// This is the provider used for the CloudFront distribution and ACM certificate for the "to" domain.
// It must always be in us-east-1, since that's where CloudFront gets deployed.
aws.cloudfront = aws.us-east-1
// This is the provider that will be used for creating DNS records in the hosted zone(s) for the "from" domains.
// It can be in any region and any AWS account, as long as it's in the same account/region as the hosted zones.
// It creates Alias records that point to the CloudFront distribution, and creates validation records
// for the ACM certificate that is used by CloudFront.
aws.route53 = aws.route53
}
// This is a map of domain names to Route53 zone IDs. The Route53
Expand Down
2 changes: 1 addition & 1 deletion acm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "cloudfront_cert" {
source = "Invicton-Labs/validated-acm-certificate/aws"
version = "~> 0.1.3"
providers = {
aws.hosted_zones = aws.route53_to
aws.hosted_zones = aws.route53
aws.certificate = aws.cloudfront
}
depends_on = [
Expand Down
2 changes: 1 addition & 1 deletion route53.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Create a Route53 record for each domain
resource "aws_route53_record" "cloudfront" {
provider = aws.route53_from
provider = aws.route53
for_each = var.domains_from
zone_id = each.value
name = each.key
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
aws = {
source = "hashicorp/aws"
version = "~> 4.8"
configuration_aliases = [aws.cloudfront, aws.route53_to, aws.route53_from]
configuration_aliases = [aws.cloudfront, aws.route53]
}
}
}

0 comments on commit 7afabfb

Please sign in to comment.