feat(secure): add sysdig_secure_zone_posture_policy_assignment resource#726
Open
tembleking wants to merge 1 commit intomasterfrom
Open
feat(secure): add sysdig_secure_zone_posture_policy_assignment resource#726tembleking wants to merge 1 commit intomasterfrom
tembleking wants to merge 1 commit intomasterfrom
Conversation
Manages the association between a sysdig_secure_zone and a set of
posture policy IDs via the CSPM API (PUT /api/cspm/v1/zones/{zoneId}/policies).
This is a standalone resource (not embedded in sysdig_secure_zone)
because the APIs have different lifecycles and it allows assigning
policies to system zones the user didn't create.
Ref: ET-836
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Terraform resource to manage CSPM posture-policy assignments for Secure Zones via the /api/cspm/v1/zones/{zoneId}/policies API, enabling policy management for both user-created and system zones as a standalone lifecycle.
Changes:
- Introduces
sysdig_secure_zone_posture_policy_assignmentresource with CRUD + import (resource ID = zone ID). - Adds a v2 client implementation (
ZonePolicyAssignmentInterface) and models for the new CSPM endpoint. - Adds acceptance coverage and provider registration, plus new user documentation for the resource.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
website/docs/r/secure_zone_posture_policy_assignment.md |
New documentation page for the resource, including example usage and import. |
sysdig/resource_sysdig_secure_zone_posture_policy_assignment.go |
Implements the Terraform resource schema and CRUD operations. |
sysdig/resource_sysdig_secure_zone_posture_policy_assignment_test.go |
Adds acceptance test coverage for create/update/import flows. |
sysdig/provider.go |
Registers the new resource in the provider. |
sysdig/internal/client/v2/zone_policy_assignment.go |
Adds v2 API client methods for zone policy assignments. |
sysdig/internal/client/v2/model.go |
Adds request/response structs for the new endpoint. |
sysdig/internal/client/v2/client.go |
Extends SecureCommon to include the new interface. |
sysdig/common.go |
Adds a shared SchemaZoneIDKey constant used by the new resource. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| data "sysdig_secure_posture_policy" "p2" { | ||
| id = 1 |
|
|
||
| # Resource: sysdig_secure_zone_posture_policy_assignment | ||
|
|
||
| Manages the association between a [`sysdig_secure_zone`](secure_zone.html) and a set of posture policy IDs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New resource
sysdig_secure_zone_posture_policy_assignmentthat manages the association between asysdig_secure_zoneand a set of posture policy IDs via the CSPM API (/api/cspm/v1/zones/{zoneId}/policies).This is a standalone resource (not embedded in
sysdig_secure_zone) because the APIs have different lifecycles and it allows assigning policies to system zones the user didn't create. The resource ID is the zone ID (1:1 relationship), andzone_idis ForceNew since changing it means a different resource.Depends on backend routing enablement:
draios/sysdigcloud-harness-cd#75479Ref: ET-836