Skip to content

Commit 1c1ea40

Browse files
committed
chore: add comment about cache_invalidation struct as slice
1 parent 60beaea commit 1c1ea40

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

provider/workspace_preset.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ type WorkspacePreset struct {
2121
}
2222

2323
type WorkspacePrebuild struct {
24-
Instances int `mapstructure:"instances"`
24+
Instances int `mapstructure:"instances"`
25+
// There should always be only one cache_invalidation block, but Terraform's type system
26+
// still parses them as a slice, so we need to handle it as such. We could use
27+
// an anonymous type and rd.Get to avoid a slice here, but that would not be possible
28+
// for utilities that parse our terraform output using this type. To remain compatible
29+
// with those cases, we use a slice here.
2530
CacheInvalidation []CacheInvalidation `mapstructure:"cache_invalidation"`
2631
}
2732

0 commit comments

Comments
 (0)