You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(zones): support v2 expression syntax for sysdig_secure_zone (#712)
<!--
Thank you for your contribution!
For a cleaner PR make sure you follow these recommendations:
- Add the **scope** of the affected area in the PR name, following
[Conventional Commit](https://www.conventionalcommits.
org/en/v1.0.0/) format
ex.: feat(secure-policy): Add runbook to policy resources
- If not there yet, add yourself and/or your team as the **Codeowners**
of the affected area
- Make sure to modify the respective **tests**
- Make sure to modify the respective **documentation**
-->
This pull request significantly enhances the `sysdig_secure_zone` data
source to support v2-compatible scope expressions, improves test
coverage, and updates dependency versions. The main focus is on allowing
richer scope filtering via expressions, ensuring backward compatibility,
and providing robust validation with new unit and acceptance tests.
Enhancements to scope expression support:
* Added support for v2-compatible scope expressions in the
`sysdig_secure_zone` data source by introducing new schema fields
(`expression`, `field`, `operator`, `value`, `values`) and merging
legacy rules with v2 expressions based on scope ID. This enables richer
and more flexible filtering in resource definitions.
[[1]](diffhunk://#diff-61c5dc355aa136849ccbeda35f10a0f35ecdd1a1964951638e4f674891f21f93R55-R60)
[[2]](diffhunk://#diff-a0229110cc4b1cae2cbc580b78c4dc26bad0bb035b9d7dcd578e40227fa2ac3dR53-R80)
[[3]](diffhunk://#diff-a0229110cc4b1cae2cbc580b78c4dc26bad0bb035b9d7dcd578e40227fa2ac3dL81-R107)
[[4]](diffhunk://#diff-a0229110cc4b1cae2cbc580b78c4dc26bad0bb035b9d7dcd578e40227fa2ac3dR118-R121)
[[5]](diffhunk://#diff-a0229110cc4b1cae2cbc580b78c4dc26bad0bb035b9d7dcd578e40227fa2ac3dR137-R140)
[[6]](diffhunk://#diff-a0229110cc4b1cae2cbc580b78c4dc26bad0bb035b9d7dcd578e40227fa2ac3dL120-R193)
Testing improvements:
* Added new acceptance tests
(`TestAccDataSourceSysdigSecureZone_ByName`,
`TestAccDataSourceSysdigSecureZone_ByID`) to verify expression support
and correct retrieval by name and ID, as well as helper methods for test
configurations.
* Introduced unit tests for the scope merging logic to ensure correct
handling of partial matches, missing IDs, and graceful degradation when
v2 data is unavailable.
Dependency and API updates:
* Updated multiple dependencies in `go.mod` to newer versions, including
`terraform-plugin-sdk`, `terraform-plugin-log`, and several indirect
dependencies for improved compatibility and security.
[[1]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L10-R18)
[[2]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L26-R27)
[[3]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L40-R50)
[[4]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L65-R82)
* Added a new `ZoneV2Interface` to the client and implemented a robust
`APIError` type with improved error extraction from API responses.
[[1]](diffhunk://#diff-3e543bee017248841b3c762241b5460f71986a4dac8ffcb87af8324adf237626R65)
[[2]](diffhunk://#diff-3e543bee017248841b3c762241b5460f71986a4dac8ffcb87af8324adf237626R78-R93)
[[3]](diffhunk://#diff-3e543bee017248841b3c762241b5460f71986a4dac8ffcb87af8324adf237626R118-R146)
* Introduced new model types for v2 zones in the client
(`ZonesV2Wrapper`, `ZoneV2`).
These changes collectively modernize the provider's handling of secure
zones, improve error reporting, and ensure comprehensive validation
through testing.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0 commit comments