feat: make cidr optional for L2 networks#219
Conversation
- Add 'type' field to cloudstack_network resource schema - Make 'cidr' field conditionally required based on network type - L2 networks: cidr not required, IP parameters skipped - L3 networks: cidr required, maintains backward compatibility - Add CustomizeDiff validation for proper type/cidr combinations - Update parseCIDR function to handle L2 networks without cidr - Update resource creation logic to skip IP config for L2 networks - Update read function to detect and set network type - Add comprehensive test coverage for L2 networks - Update documentation with L2 and L3 usage examples Fixes apache#214
|
Thanks @sidshas03 , could you please check the test failures and rectify them |
- Fix formatting issues in resource_cloudstack_network.go - Fix formatting issues in resource_cloudstack_instance.go - Ensures CI formatting checks pass without changing functionality
- Add TestResourceCloudStackNetworkSchema to validate schema structure - Add TestParseCIDR to test CIDR parsing logic for both L2 and L3 networks - Verify L2 networks return empty CIDR parsing results - Verify L3 networks require CIDR and parse correctly - All tests pass, ensuring functionality works as expected
- Add Apache License, Version 2.0 header to resource_cloudstack_network_parse_test.go - Add Apache License, Version 2.0 header to resource_cloudstack_network_validation_test.go - Addresses code review feedback from DaanHoogland - Ensures compliance with Apache Software Foundation licensing requirements
7676559 to
440ec8c
Compare
|
Hi @DaanHoogland & @kiranchavala, Just putting down the commit history clearly so you both know what happened and why:
Thanks for the reviews so far. Requesting you to please review the workflows when convenient. |
- Remove trailing whitespace from test files - Ensures CI formatting checks pass - No functional changes to code logic
|
@sidshas03 still there are test failures please look into them |
…mizeDiff, normalize L2 in Read; plus errcheck fix - Make type field Optional+Computed to prevent drift when config omits it - Default type from cidr presence in CustomizeDiff (cidr present = L3, absent = L2) - Normalize L2 networks in Read by clearing cidr/gateway to prevent plan drift - Fix unchecked errors in resource_cloudstack_configuration.go - Update validation tests to reflect new schema behavior This ensures backward compatibility - existing configs without explicit type will continue to work without modification.
|
@sidshas03 could you please look into the failing tests |
Fixes #214