title: Why error, "alias target name does not lie within the target zone" in Terraform aws_route53_record?
body: <p>With Terraform 0.12, I am creating a static web site in an S3 bucket:</p>
  
  <pre><code>...
  
  resource "aws_s3_bucket" "www" {
    bucket = "example.com"
    acl    = "public-read"
    policy = &lt;&lt;-POLICY
      {
        "Version": "2012-10-17",
        "Statement": [{
          "Sid": "AddPerm",
          "Effect": "Allow",
          "Principal": "*",
          "Action": ["s3:GetObject"],
          "Resource": ["arn:aws:s3:::example.com/*"]
        }]
      }
      POLICY
    website {
      index_document = "index.html"
      error_document = "404.html"
    }
  
    tags = {
      Environment = var.environment
      Terraform = "true"
    }
  }
  
  resource "aws_route53_zone" "main" {
    name = "example.com"
  
    tags = {
      Environment = var.environment
      Terraform = "true"
    }
  }
  
  resource "aws_route53_record" "main-ns" {
    zone_id = aws_route53_zone.main.zone_id
    name    = "example.com"
    type    = "A"
    alias {
      name                   = aws_s3_bucket.www.website_endpoint
      zone_id                = aws_route53_zone.main.zone_id
      evaluate_target_health = false
    }
  }
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Error: [ERR]: Error building changeset: InvalidChangeBatch:
  [Tried to create an alias that targets example.com.s3-website-us-west-2.amazonaws.com., type A in zone Z1P...9HY, but the alias target name does not lie within the target zone, 
   Tried to create an alias that targets example.com.s3-website-us-west-2.amazonaws.com., type A in zone Z1P...9HY, but that target was not found]
      status code: 400, request id: 35...bc
  
    on main.tf line 132, in resource "aws_route53_record" "main-ns":
   132: resource "aws_route53_record" "main-ns" {
  </code></pre>
  
  <p>What is wrong?</p>