Skip to content

Commit d721b58

Browse files
authored
fix(zone): using variable for primary nameservers causes error (#1306)
When evaluating the plan, terraform does multiple rounds of validation, with more and more of the resource attributes known. At first, the variable is unknown, so our custom validation shows `Error: Required attribute`, even though the variable is actually configured. We can skip checking for unknown, and rely on terraform calling us again once the variable is actually known to validate if it is null or not. Fixes #1302
1 parent d1c148b commit d721b58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/zone/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (r *Resource) ValidateConfig(ctx context.Context, req resource.ValidateConf
166166
)
167167
}
168168
case string(hcloud.ZoneModeSecondary):
169-
if data.PrimaryNameservers.IsUnknown() || data.PrimaryNameservers.IsNull() {
169+
if data.PrimaryNameservers.IsNull() {
170170
resp.Diagnostics.AddAttributeError(
171171
path.Root("primary_nameservers"),
172172
"Required attribute",

0 commit comments

Comments
 (0)