Loading...
Loading...
### Terraform Version ```shell Terraform v1.10.5 on darwin_arm64 ``` ### Terraform Configuration Files ``` module "files" { source = "./files" environment = var.environment region = var.region } ``` ### Debug Output ``` # module.monitoring.module.files.aws_s3_bucket.files will be destroyed # (because aws_s3_bucket.files is not in configuration) ``` ### Expected Behavior Initially, I placed my files module inside the monitoring module. However, I later decided to move it one level up. To do this, I removed the module definition from main.tf inside the monitoring module and redefined it in the root main.tf. I expected Terraform to recognize the module in its new location and disregard the old path. ### Actual Behavior Terraform recognizes both module.monitoring.module.files.aws_s3_bucket.files (the old path) and module.files.aws_s3_bucket.files (the new path). I have no issues with the new module, but since Terraform tries to destroy the old resources, it fails because the S3 bucket is not empty. After manually deleting the bucket from AWS, the error disappeared. ### Steps to Reproduce 1. create a module 2. plan and apply 3. move the module into another folder 4. plan and apply ### Additional Context I know i changed my configuration file, but imho terraform have to know the new and old one and handle this changes appropriately or at least show a better error message. ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.