Managing the same aws_route53_zone from different projects

I’m working on a project with three different code bases for the same product. All the projects should be able to add records (aws_route53_record) to the same private hosted zone (aws_route53_zone) on the same VPC.

Tried to add a new record on one of the projects but terraform added a new private hosted zone with the same name and added the record.

How can I make this work? I was thinking about creating the zone on the first project and importing the zone from the two other projects and using

  lifecycle {
    ignore_changes = true

to allow changes from any of the projects.

Is there a better approach?

Thanks in advance,

Ideally I should be able to create the zone and add DNS records from any of the three projects.

for separate directories working on the same resources, you should use the shared state like storing the state on Terraform Cloud/S3/etc.


I have three different projects, each with its own state file. Managed to solve it by creating the DNS zone on one project, and the other two use data to query existing zone and adding records from there.