Description
Terraform Version
Terraform v1.11.4
on darwin_arm64
Terraform Configuration Files
Given a terraform module at bitbucket.org:some/internal-project:
module "module_copy_1" {
source = "git::[email protected]:our-organization/parent-project?ref=2.8.0"
# Properties
}
module "module_copy_2" {
source = "git::[email protected]:our-organization/parent-project?ref=2.8.0"
# Properties
}
Where parent-project
has the following module:
module "internal_project_release_5_0_6" {
source = "git::[email protected]:our-organization/internal-project?ref=5.0.6"
upload_prefix = "releases/5.0.6"
}
And our-organization/internal-project
has:
resource "qbee_filemanager_file" "some_hidden_file" {
path = "${var.upload_prefix}/.update"
sourcefile = "${path.module}/files/shared/.update"
file_sha256 = filesha256("${path.module}/files/shared/.update")
}
Debug Output
The relevant part of the debug output, where this module is copied:
2025-04-15T12:59:36.376+0200 [DEBUG] Module installer: begin module_copy_1.internal_project_release_5_0_6
2025-04-15T12:59:36.376+0200 [TRACE] ModuleInstaller: module_copy_1.internal_project_release_5_0_6 is not yet installed
2025-04-15T12:59:36.376+0200 [TRACE] ModuleInstaller: cleaning directory .terraform/modules/module_copy_1.internal_project_release_5_0_6 prior to install of module_copy_1.internal_project_release_5_0_6
2025-04-15T12:59:36.376+0200 [TRACE] ModuleInstaller: module_copy_1.internal_project_release_5_0_6 address "git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6" will be handled by go-getter
Downloading git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6 for module_copy_1.internal_project_release_5_0_6...
2025-04-15T12:59:36.376+0200 [TRACE] getmodules: fetching "git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6" to ".terraform/modules/module_copy_1.internal_project_release_5_0_6"
2025-04-15T12:59:42.533+0200 [TRACE] ModuleInstaller: module_copy_1.internal_project_release_5_0_6 "git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6" was downloaded to .terraform/modules/module_copy_1.internal_project_release_5_0_6
2025-04-15T12:59:42.538+0200 [DEBUG] Module installer: module_copy_1.internal_project_release_5_0_6 installed at .terraform/modules/module_copy_1.internal_project_release_5_0_6
- module_copy_1.internal_project_release_5_0_6 in .terraform/modules/module_copy_1.internal_project_release_5_0_6
...
2025-04-15T13:00:11.527+0200 [TRACE] ModuleInstaller: cleaning directory .terraform/modules/module_copy_2.internal_project_release_5_0_6 prior to install of module_copy_2.internal_project_release_5_0_6
2025-04-15T13:00:11.527+0200 [TRACE] ModuleInstaller: module_copy_2.internal_project_release_5_0_6 address "git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6" will be handled by go-getter
Downloading git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6 for module_copy_2.internal_project_release_5_0_6...
2025-04-15T13:00:11.527+0200 [TRACE] getmodules: copying previous install of "git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6" from .terraform/modules/module_copy_1.internal_project_release_5_0_6 to .terraform/modules/module_copy_2.internal_project_release_5_0_6
2025-04-15T13:00:11.660+0200 [TRACE] ModuleInstaller: module_copy_2.internal_project_release_5_0_6 "git::ssh://[email protected]/our-organization/internal-project?ref=5.0.6" was downloaded to .terraform/modules/module_copy_2.internal_project_release_5_0_6
2025-04-15T13:00:11.664+0200 [DEBUG] Module installer: module_copy_2.internal_project_release_5_0_6 installed at .terraform/modules/module_copy_2.internal_project_release_5_0_6
- module_copy_2.internal_project_release_5_0_6 in .terraform/modules/module_copy_2.internal_project_release_5_0_6
Expected Behavior
The hidden file in our internal-project/files/.update
should be present for both module installations. I want to either force Terraform to not copy existing modules and download each time, or ideally, correctly use the cached directory and not ignore dot-files.
Actual Behavior
The file starting with a .
is only present for the first module downloaded. The second module instead copies the installed module, as specified in
terraform/internal/getmodules/getter.go
Line 125 in c161997
terraform/internal/copy/copy_dir.go
Line 31 in c161997
Steps to Reproduce
terraform init
terraform plan
The plan will fail since the dot-file does not exist, making the sha256
method crash.
Additional Context
No response
References
No response
Generative AI / LLM assisted development?
No response