Bernard Halas
Bernard Halas

Reputation: 1190

Terraform: Mutliple providers, each with its own statefile

I know it's possible to combine multiple providers in a single Terraform project.

Would it be possible though, to declare different statefile per provider? In our use-case we will be deploying infrastructure with its part in the client's cloud provider account and other part within our cloud provider account.

We'd like to keep the statefiles separated (client's TF state vs our TF state), in order to allow smoother future migrations of either our part of the infra or client's part of the infra.

We also know that this can be achieved using Terragrunt on top of Terraform, but for the moment we'd prefer to avoid introducing a new tool into our stack. Hence looking for a TF-only solution (if such exists).

Upvotes: 1

Views: 44

Answers (1)

Samuel Stoličný
Samuel Stoličný

Reputation: 36

The simplest solution would be to use separate folders for your and your client's infrastructure.

Is there a specific reason why you would want to keep them in one folder? Even if you need to share some values, you can easily read them by using terraform_remote_state

Upvotes: 2

Related Questions