title: Get zone id for an exisiting zone or create a new zone with zone name
body: <p>I am using cdktf to generate terraform code, and want to get the zone_id for an existing zone so I can create new records in it.</p>
  <pre class="lang-json prettyprint-override"><code>&quot;aws_route53_zone&quot;: {
        &quot;typescript-aws_get_zone_id_C1732EA4&quot;: {
          &quot;name&quot;: &quot;mydomain.com&quot;,
          &quot;//&quot;: {
            &quot;metadata&quot;: {
              &quot;path&quot;: &quot;custom_stack/typescript-aws/get_zone_id&quot;,
              &quot;uniqueId&quot;: &quot;typescript-aws_get_zone_id_C1732EA4&quot;
            }
          }
        }
      },
      ...
  &quot;aws_route53_record&quot;: {
        &quot;typescript-aws_aws_cloudfront_mydomaincom_aws_cloudfront_mydomaincom_record_5E08FD7F&quot;: {
          &quot;name&quot;: &quot;mydomain.com&quot;,
          &quot;type&quot;: &quot;A&quot;,
          &quot;zone_id&quot;: &quot;${aws_route53_zone.typescript-aws_get_zone_id_C1732EA4.zone_id}&quot;,
          &quot;alias&quot;: [
            {
              &quot;evaluate_target_health&quot;: false,
              &quot;name&quot;: &quot;${aws_cloudfront_distribution.typescript-aws_aws_cloudfront_mydomaincom_4EF84BC8.domain_name}&quot;,
              &quot;zone_id&quot;: &quot;${aws_cloudfront_distribution.typescript-aws_aws_cloudfront_mydomaincom_4EF84BC8.hosted_zone_id}&quot;
            }
          ],
          &quot;//&quot;: {
            &quot;metadata&quot;: {
              &quot;path&quot;: &quot;custom_stack/typescript-aws/aws_cloudfront_mydomain.com/aws_cloudfront_mydomain.com_record&quot;,
              &quot;uniqueId&quot;: &quot;typescript-aws_aws_cloudfront_mydomaincom_aws_cloudfront_mydomaincom_record_5E08FD7F&quot;
            }
          }
        },
  </code></pre>
  <p>However, this always creates a new zone (whose name matches an exisiting zone, but both have separate zone ids.</p>
  <p>I referred to this question ( <a href="https://stackoverflow.com/questions/63402926/fetch-zone-id-of-hosted-domain-on-route53-using-terraform">Fetch zone_id of hosted domain on route53 using terraform</a> ) but seems like the flag suggested in the approved answer is no longer available? At least not as per the docs ( <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone" rel="nofollow noreferrer">https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone</a> )</p>