Loading...
Loading...
### Terraform Version ```shell Terraform v1.10.5 on linux_amd64 ``` ### Terraform Configuration Files Empty ### Debug Output https://gist.github.com/g7r/586fb5a37f3eb10af7103666636a20e8 ### Expected Behavior There is a discrepancy between the output of `terraform plan` and the actual behavior of `terraform apply` when using `-target`. `terraform plan` may indicate that `module.children["item3"].terraform_data.this` will be destroyed, even if it's outside the `-target` scope. This leads to confusion. Expected behavior: 1. `terraform plan -target` should be strictly scoped to the provided target, showing only those resources that `terraform apply` will modify. OR 2. `terraform apply` should consistently apply all changes indicated in the preceding `terraform plan`. ### Actual Behavior `terraform plan -target` outputs (excerpt): ``` # module.children["item1"].terraform_data.this will be updated in-place # module.children["item3"].terraform_data.this will be destroyed ``` `terraform apply` updates `module.children["item1"].terraform_data.this` but doesn't destroy `module.children["item3"].terraform_data.this` ### Steps to Reproduce 1. `git clone https://github.com/g7r/tf-module-for-each-target.git` 2. `cd tf-module-for-each-target` 3. `terraform init` 4. `terraform apply -var init=true -auto-approve` 5. `terraform plan -target 'module.children["item1"].terraform_data.this' -out plan.tfplan` 6. `terraform apply plan.tfplan` ### Additional Context _No response_ ### 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.