Error tagging resources


sometimes I am getting issues while tagging resources in terraform in the resource block:

resource "aws_vpc_peering_connection" "src_peering" {
provider = aws.src
peer_owner_id = var.peering.different_account ? var.peering.account_id : null
vpc_id = var.peering.src_vpc_id
peer_vpc_id = var.peering.dst_vpc_id
peer_region   = var.stackCommon.stack_region
auto_accept   = false

tags = merge(
        "Name", "${var.stackCommon.stack_name}-${var.peering.peering_connection_name}"

lifecycle {
    create_before_destroy = true


    error updating EC2 VPC Peering Connection (pcx-002e3d030ff430f7c) tags: error tagging resource (pcx-002e3d030ff430f7c): InvalidVpcPeeringConnectionID.NotFound: The vpcPeeringConnection ID 'pcx-002e3d030ff430f7c' does not exist
	status code: 400, request id: 0ade2c59-4cea-4ec9-bcef-ba1a480a41ec

Tagging fails not only for peering but often for Security groups, EIP’s with the same kind of error. Dependencies are OK. Am I doing this wrong? 95% of the time it works properly.