Terraform conditions and logic management

Hi I’m new to terraform and I have a task where I need to create repository’s in bitbucket. I have found a provider I can use to create the repo’s and a provider to query a repo list.

But I’m really have a hard time figuring out how to do “logic”. I need to check the output from the query provider to see if the repo I want to create exist or not. And if it does not I should create it.

However terraform does not support if statements. unless I use a Provisioner or null provider or External Data Source.

Am I missing something or would the right course of action be one of these approach or maybe using something else like ansible (configuration management) and terraform (infrastructure as code)