Commit 8a1cd6f
authored
fix: prevent unnecessary updates when cpu_options is unset (#4806)
This PR will replace:
```hcl
cpu_options {
core_count = var.cpu_options != null ? var.cpu_options.core_count : null
threads_per_core = var.cpu_options != null ? var.cpu_options.threads_per_core : null
}
```
with:
```hcl
dynamic "cpu_options" {
for_each = var.cpu_options != null ? [var.cpu_options] : []
content {
core_count = try(cpu_options.value.core_count, null)
threads_per_core = try(cpu_options.value.threads_per_core, null)
}
}
```
This way, if `cpu_options` is not set, Terraform will **not force a
resource update every time**.
This issue was introduced in PR #4789
<img width="346" height="94" alt="image"
src="https://github.com/user-attachments/assets/5a3ca60d-7300-4957-91c3-ff87c2cd5b62"
/>1 parent 3f115cd commit 8a1cd6f
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| |||
0 commit comments