Terraform and Openstack

Can a terraform git repo, full of AWS resources already, also have openstack resources defined alongside the AWS resources?

What or how do I specify which provider to use and when?

It’s almost like having a feature toggle set to tell Terraform Enterprise “Hey, this run is going to Openstack and not AWS!”

Yes you can use as many providers as you like. There’s no toggling - all providers are always used

True, I can specify many different providers but how can I run terraform to only deploy Openstack resources which effectively would ignore any of my AWS resources?

Sounds tricky eh? Does anyone have a solution here that works for them aside from two different workspaces or Git repos that achieve the same infrastructure but with different providers? I’d like to use something like a feature toggle. Anyone?

That’s not really the intention of Terraform. You define the state you want via code and the tool then makes that state reality. The providers needed to achieve that (of which there are lots of possibilities) is just a detail rather than something you worry about when running the plan/apply.

You can use -target to only apply parts of the code, but that is not expected to be a common way to run Terraform, and identifies things via their resource name, not the provider(s) needed.

If you want to have totally separate deployments it is best to structure that as two different state files, which generally is two git repos or different directories. I wouldn’t look to use workspaces for this, as those are generally used where you have the same code but different variables, rather than totally different code.