Skip to content

Commit 6776664

Browse files
authored
Merge pull request #36719 from hashicorp/jbardin/zero-instance-ephem
make sure ephemeral nodes with zero instances work
2 parents 71dbc7d + d83acee commit 6776664

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: BUG FIXES
2+
body: Modules with zero instances that contain ephemeral resources could produce an error during apply
3+
time: 2025-03-19T09:12:34.565564-04:00
4+
custom:
5+
Issue: "36719"

internal/terraform/context_apply_ephemeral_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ provider "test" {
142142
143143
resource "test_object" "test" {
144144
}
145+
146+
# make sure ephemerals with zero instances are processed correctly too
147+
module "zero" {
148+
count = 0
149+
source = "./mod"
150+
input = "test"
151+
}
145152
`,
146153
"./mod/main.tf": `
147154
variable input {
@@ -154,6 +161,7 @@ output "data" {
154161
ephemeral = true
155162
value = ephemeral.ephem_resource.data.value
156163
}
164+
157165
`,
158166
})
159167

internal/terraform/node_resource_apply.go

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ func (n *nodeExpandApplyableResource) dynamicExpandEphemeral(ctx EvalContext) (*
8484
diags = diags.Append(expDiags)
8585
}
8686

87+
addRootNodeToGraph(&g)
88+
8789
return &g, diags
8890
}
8991

0 commit comments

Comments
 (0)