Is it supported for per-module state file?

I have several modules shared by different project, e.g. projectA/ and projectB/, written by terraform like below

module “moduelA” {
source = “./modules/moduelA”

I have set the remote backend to use AWS s3 bucket “moduleA” to store state file, and would like a) moduleA to generate its own state file which separates from other modules and b) moduleA reuses the same state file regardless it’s used by projectA or projectB

Is it doable?


Hi @tigerwan,

State is an artifact associated with the entire configuration, rather than with individual modules. There isn’t any way to use a separate state for a particular module in a configuration. If you want to decompose your system, the usual approach is to create separate configurations that share data using data sources.