fix(ci): use owned resource in posture zone test to prevent flakiness#703
Merged
tembleking merged 1 commit intomasterfrom Feb 11, 2026
Merged
fix(ci): use owned resource in posture zone test to prevent flakiness#703tembleking merged 1 commit intomasterfrom
tembleking merged 1 commit intomasterfrom
Conversation
The test used `data.sysdig_secure_posture_policies.all.policies[0].id` to reference a policy, but the data source returns policies in non-deterministic order. Between apply and refresh, re-reading the data source could yield a different policy at index 0, causing "plan was not empty" failures on `policy_ids`. Replace the data source lookup with a test-owned `sysdig_secure_posture_policy` resource so the ID is stable across reads.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes flakiness in the TestAccSecurePostureZone acceptance test by replacing non-deterministic policy lookups with a test-owned resource. The test was failing intermittently because it relied on a data source that returned policies in an unpredictable order, causing plan drift between apply and refresh operations.
Changes:
- Replaced the
sysdig_secure_posture_policiesdata source with a dedicatedsysdig_secure_posture_policyresource - Updated the zone resource to reference the stable policy ID from the test-owned resource
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
davidag
approved these changes
Feb 11, 2026
fcracker79
pushed a commit
that referenced
this pull request
Mar 5, 2026
…#703) `TestAccSecurePostureZone` fails intermittently in CI (IBM Secure Acceptance Tests) at Step 3/4 with "plan was not empty" on `policy_ids`. The test used `data.sysdig_secure_posture_policies.all.policies[0].id` to get a policy ID, but the data source returns policies in non-deterministic order from the API. Between apply and refresh, the data source is re-read and `policies[0]` can resolve to a different policy, causing drift. This replaces the data source lookup with a test-owned `sysdig_secure_posture_policy` resource so the ID is stable across reads.
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.
TestAccSecurePostureZonefails intermittently in CI (IBM Secure Acceptance Tests) at Step 3/4 with "plan was not empty" onpolicy_ids.The test used
data.sysdig_secure_posture_policies.all.policies[0].idto get a policy ID, but the data source returns policies in non-deterministic order from the API. Between apply and refresh, the data source is re-read andpolicies[0]can resolve to a different policy, causing drift.This replaces the data source lookup with a test-owned
sysdig_secure_posture_policyresource so the ID is stable across reads.