Is there a way to implement optional provider?

I wrote a module to create an AWS VPC. If the consumer choose to use a cross account transit gateway, I need to also create an accepter resource in the owner’s account in order to establish the connection. Thus, I need a way to create optional AWS provider where it should only “exist” if transit gateway is selected. Otherwise I want to ignore it. Is it possible?