Unable to create Cross Account VPC Peering

I am trying to create a cross account VPC peering as a requestor through terraform script but it keeps throwing InvalidVPC ID which is referring to my accepter VPC. I have provided the accepter account id in peer_owner_id but it seems like its looking up the VPC ID in the requester account. Following is my configuration.

data “aws_vpc” “acceptor_vpc” {
id = var.acceptor_vpc_id

data “aws_vpc” “requestor_vpc” {
id = var.requestor_vpc_id

resource “aws_vpc_peering_connection” “vpc_peering” {
count = var.enable ? 1 : 0

peer_owner_id = var.peer_owner_id == null ? null : var.peer_owner_id

peer_vpc_id = var.acceptor_vpc_id
vpc_id = var.requestor_vpc_id
auto_accept = true

tags = {
Name = “vpc-peer-{data.aws_vpc.requestor_vpc.tags["Name"]}-{data.aws_vpc.acceptor_vpc.tags[“Name”]}”
Env = var.env



Error: InvalidVpcID.NotFound: The vpc ID ‘vpc-XXXXX’ does not exist
status code: 400, request id: 80362a8a-f24c-49dd-8054-38c68XXXXX

I’ve tried to hardcode the peer_own_id but it didnt work.

Not too sure what went wrong. Would appreciate if anyone could help.

if using two separate AWS accounts from within the same directory, you will need two separate provider blocks, each resource part of the corresponding provider.
You can use the alias directive to separate the provider blocks.