in mmv1/provider/terraform.go [304:352]
func (t Terraform) getCommonCopyFiles(versionName string, generateCode, generateDocs bool) map[string]string {
// key is the target file and value is the source file
commonCopyFiles := make(map[string]string, 0)
// Case 1: When copy all of files except .tmpl in a folder to the root directory of downstream repository,
// save the folder name to foldersCopiedToRootDir
foldersCopiedToRootDir := []string{"third_party/terraform/META.d", "third_party/terraform/version"}
// Copy TeamCity-related Kotlin & Markdown files to TPG only, not TPGB
if versionName == "ga" {
foldersCopiedToRootDir = append(foldersCopiedToRootDir, "third_party/terraform/.teamcity")
}
if generateCode {
foldersCopiedToRootDir = append(foldersCopiedToRootDir, "third_party/terraform/scripts")
}
if generateDocs {
foldersCopiedToRootDir = append(foldersCopiedToRootDir, "third_party/terraform/website")
}
for _, folder := range foldersCopiedToRootDir {
files := t.getCopyFilesInFolder(folder, ".")
maps.Copy(commonCopyFiles, files)
}
// Case 2: When copy all of files except .tmpl in a folder to the google directory of downstream repository,
// save the folder name to foldersCopiedToGoogleDir
var foldersCopiedToGoogleDir []string
if generateCode {
foldersCopiedToGoogleDir = []string{"third_party/terraform/services", "third_party/terraform/acctest", "third_party/terraform/sweeper", "third_party/terraform/provider", "third_party/terraform/tpgdclresource", "third_party/terraform/tpgiamresource", "third_party/terraform/tpgresource", "third_party/terraform/transport", "third_party/terraform/fwmodels", "third_party/terraform/fwprovider", "third_party/terraform/fwtransport", "third_party/terraform/fwresource", "third_party/terraform/fwutils", "third_party/terraform/fwvalidators", "third_party/terraform/verify", "third_party/terraform/envvar", "third_party/terraform/functions", "third_party/terraform/test-fixtures"}
}
googleDir := "google"
if versionName != "ga" {
googleDir = fmt.Sprintf("google-%s", versionName)
}
// Copy files to google(or google-beta or google-private) folder in downstream
for _, folder := range foldersCopiedToGoogleDir {
files := t.getCopyFilesInFolder(folder, googleDir)
maps.Copy(commonCopyFiles, files)
}
// Case 3: When copy a single file, save the target as key and source as value to the map singleFiles
singleFiles := map[string]string{
"go.sum": "third_party/terraform/go.sum",
"go.mod": "third_party/terraform/go.mod",
".go-version": "third_party/terraform/.go-version",
"terraform-registry-manifest.json": "third_party/terraform/terraform-registry-manifest.json.tmpl",
}
maps.Copy(commonCopyFiles, singleFiles)
return commonCopyFiles
}