Terraform crash with "runtime error: invalid memory address or nil pointer dereferencegoroutine 3126" when removing count attribute #30771
Labels
bug
new
new issue not yet triaged
waiting-response
An issue/pull request is waiting for a response from the community
First time issue-opener here... Please, let me know if this is not according to expectations.
Terraform Version
Terraform Configuration Files
I was working on a "monitoring" module (to be used in many of our projects - e.g., setting up diagnostic settings to forward application insights log data to an event hub, in turn consumed by an Azure Function that forwards all logs to our DataDog - but probably not relevant for this error.).
While it was work in progress I wanted it to only run in our test environment so I added the count attribute to "target" it only to our test environment.Once ready I removed the "count" to put it in all the environments. Re-adding count solved the issue.
Debug Output
Expected Behavior
It would be awesome if Terraform could handle such a change - but I'm guessing that's more of a feature request.
Minimum expected behaviour: It gives a clear error message without crashing.
Actual Behavior
The plan for our test environment failed (see above) but the plan for other environments succeeded. The other environments use the same config but different tfvars (file + command-line args).
Steps to Reproduce
In short, this is what happened (but over a longer course of time as there's been intermittent plans/applies):
Plan now fails for the "setting" that had been applied in (2) while any new "setting" works.
Plan now works again.
Additional Context
TerraformTaskV2@2
References
At first I commented here #30760 because I was unsure if it was related or not.
The text was updated successfully, but these errors were encountered: