Loading...
Loading...
### Terraform Version ``` Terraform v1.16.0-dev (main branch, HEAD) ``` ### Terraform Configuration Files This is an internal code bug affecting any ephemeral resource that encounters a renewal error: ```terraform ephemeral "example" "this" { # any ephemeral resource that renews and encounters a renewal error } ``` ### Debug Output No debug output available because the bug causes diagnostics to be silently dropped. The issue is visible in the source code at `internal/terraform/node_resource_ephemeral.go` in the `handleRenewal` function. ### Expected Behavior When an ephemeral resource renewal fails, the error diagnostics should be captured and propagated to the caller, allowing Terraform to report the renewal failure and mark the resource as unhealthy. ### Actual Behavior `tfdiags.Diagnostics.Append()` returns a new slice (it does not modify the receiver). In `handleRenewal`, the return value is discarded: ```go r.renewDiags.Append(diags) // return value lost ``` This silently drops all renewal error diagnostics, causing two downstream effects: - `InstanceValue` incorrectly reports the resource as live after a failed renewal, because `renewDiags.HasErrors()` is always false - `close` loses all renewal diagnostics when surfacing errors to the caller The correct pattern is already used on line 270 of the same file: `r.renewDiags = r.renewDiags.Append(ctx.Err())` ### Steps to Reproduce 1. Review `internal/terraform/node_resource_ephemeral.go`, function `handleRenewal` 2. Note `r.renewDiags.Append(diags)` discards the return value 3. Compare with line 270 which correctly assigns the result: `r.renewDiags = r.renewDiags.Append(ctx.Err())` ### Additional Context The bug was introduced in commit 0e80c0b791 (2024-09-16, initial ephemeral resources implementation). I intend to submit a fix for this issue and have a working implementation on my fork. ### References - Previously submitted as #38544 (closed; resubmitting with issue-first workflow per Contributing.md) - Fork branch with fix: [`SebTardif/terraform@fix/ephemeral-renew-diags`](https://github.com/SebTardif/terraform/tree/fix/ephemeral-renew-diags) ### Generative AI / LLM assisted development? Grok (xAI) was used as an assistant with human-in-the-loop review. All code has been reviewed and understood by the human author.
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.