When I attempt to add the host zone id from my AWS route53 dashboard, terraform fails indicating that
‘A managed resource “aws_route53_zone” “<my_host_zone_id>” has not been declared in the root module.’
Is there something I need to address within AWS or is my syntax somehow incorrect? main.tf config is as follows:
resource "aws_s3_bucket_acl" "web_bucket" {
bucket = "mywebsitebucket"
acl = "public-read"
}
resource "aws_acm_certificate" "web_cert" {
domain_name = "mywebsite.com"
validation_method = "DNS"
}
resource "aws_route53_record" "www_record" {
zone_id = aws_route53_zone.<string_from_rt53_dashboard>.id
name = "www.mywebsite.com"
type = "A"
ttl = 3600
records = [aws_cloudfront_distribution.web_distribution.domain_name]
I have attempted terraform apply using both ‘.id’ and ‘zone_id’. Please advise. Thanks.