Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path change during module upgrade results in error #75

Closed
bharathkkb opened this issue Aug 18, 2020 · 2 comments
Closed

Path change during module upgrade results in error #75

bharathkkb opened this issue Aug 18, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@bharathkkb
Copy link
Member

Error

In a scenario as described below, upgrading from one module version to next results in error.

module "foo" {
  source            = "terraform-google-modules/gcloud/google"
+  version           = "1.4.1"
-  version           = "1.4.0"
....
}

Error:

 Error running command '.terraform/modules/bar.foo/terraform-google-gcloud-1.4.0/scripts/check_components.sh gcloud foo bar': exit status 127. Output: /bin/sh: .terraform/modules/bar.foo/terraform-google-gcloud-1.4.0/scripts/check_components.sh: not found

The reason seems to be that initially the directory structure is

main.tf
.terraform
    - modules > bar.foo > terraform-google-gcloud-1.4.0

but after a tf init with the new version of the module, it becomes

main.tf
.terraform
    - modules > bar.foo > terraform-google-gcloud-1.4.1

hence the file .terraform/modules/bar.foo/terraform-google-gcloud-1.4.0/scripts/check_components.sh no longer exists and has been replaced by .terraform/modules/bar.foo/terraform-google-gcloud-1.4.1/scripts/check_components.sh

Workaround

Possible workaround seems to be to taint the resource but is not ideal.

terraform taint module.example.module.bar.foo.null_resource.additional_components_destroy[0]
@bharathkkb bharathkkb added the bug Something isn't working label Aug 18, 2020
@morgante
Copy link
Contributor

Could we autotaint somehow? I don't see any easy fix here unfortunately.

@bharathkkb
Copy link
Member Author

I believe this should longer be an issue as with hashicorp/terraform#26143 the folder dir will no longer have the version appended. This should resolve the issue for most use cases, the only other case would be if we change the dir locations within the module. At that point, we should consider a breaking release or add some instructions to taint as defined here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants