How to run Test from HCP for mono repo terraform modules

Background:

We have several terraform modules in a single GitHub repository(mono repo).

Our module structure resembles something like the below (simplified):

    modules/
          storage/
              |-- main.tf
              |-- variables.tf   
	          |-- output.tf
         datalake/
               | -- main.tf          
 	           |-- variables.tf 
    	       |-- output.tf
       .
	   .
	   .
     examples/
        storage/
	           |-- main.tf  
               |-- variables.tf   
	           |-- terraform.tfvars
	           tests/
	             | -- storage.tftest.hcl
        datalake/
               |-- main.tf 
 	           |-- variables.tf 
	           |-- terraform.tfvars
                tests/
	                 | -- datalake.tftest.hcl
      .
      .
      .

Problem:

In this approach(mono repo modules), how do we enable/configure test-integrated modules in the HCP Terraform private registry?

(We enabled branch-based publishing workflow, but the HCP Terraform test only recognizes the files from the repo’s root directory but not from subdirectories.)

I appreciate any help you can provide.

1 Like