Commit cad7264
committed
Fix managed mode to properly handle out-of-band ACL rules
When managed=true, the provider now correctly detects and deletes ACL rules
that were created outside of Terraform (out-of-band rules).
Implementation:
- Read function adds 'dummy' rules to state for out-of-band rules when managed=true
- These dummy rules contain the UUID of the out-of-band rule
- On next apply, Terraform detects the diff (dummy rule in state, not in config)
- Update function deletes the dummy rules, which deletes the actual out-of-band rules
This approach is consistent with the legacy resource_cloudstack_network_acl_rule.go
and ensures that managed ACLs stay in sync with the configuration.
Also fixes state mutation issues in the Read function by creating new maps
instead of modifying existing state data structures.
Tests:
- Added TestAccCloudStackNetworkACLRuleset_managed to verify out-of-band deletion
- Verified TestAccCloudStackNetworkACLRuleset_not_managed still works correctly1 parent 35b83ae commit cad7264
2 files changed
Lines changed: 75 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
347 | | - | |
| 346 | + | |
| 347 | + | |
348 | 348 | | |
349 | | - | |
| 349 | + | |
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
375 | 379 | | |
376 | 380 | | |
377 | 381 | | |
| |||
450 | 454 | | |
451 | 455 | | |
452 | 456 | | |
| 457 | + | |
453 | 458 | | |
454 | 459 | | |
455 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
456 | 464 | | |
| 465 | + | |
457 | 466 | | |
458 | 467 | | |
459 | 468 | | |
460 | 469 | | |
461 | 470 | | |
462 | | - | |
| 471 | + | |
463 | 472 | | |
464 | | - | |
| 473 | + | |
465 | 474 | | |
466 | 475 | | |
467 | 476 | | |
| |||
Lines changed: 52 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
146 | 168 | | |
147 | 169 | | |
148 | 170 | | |
| |||
500 | 522 | | |
501 | 523 | | |
502 | 524 | | |
| 525 | + | |
| 526 | + | |
503 | 527 | | |
504 | 528 | | |
505 | 529 | | |
| |||
513 | 537 | | |
514 | 538 | | |
515 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
516 | 568 | | |
517 | 569 | | |
518 | 570 | | |
519 | 571 | | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | 572 | | |
524 | 573 | | |
525 | 574 | | |
| |||
0 commit comments