Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db/fix predicate validation bug #547

Merged
merged 4 commits into from
Dec 13, 2024
Merged

Conversation

davidbloss
Copy link
Contributor

@davidbloss davidbloss commented Dec 12, 2024

Resolves #496

Problem

Validation incorrectly fails on valid predicate blocks.

Given the example config:

resource "opslevel_check_service_property" "example" {
  for_each = var.my_values
  ...
  predicate = {
    type  = "satisfies_jq_expression"
    value = ".${each.key} | my_filter"
  }
}

PredicateObjectToModel() incorrectly converts the predicate.value field into a known empty string, when in fact predicate.value has an unknown state during the first validation pass since ${each.key} hasn't been resolved yet.

Solution

Ensure PredicateObjectToModel() preserves the unknown state on the first validation pass.

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR does not reduce total test coverage
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Make a changie entry that explains the customer facing outcome of this change

@davidbloss davidbloss added the bug Something isn't working label Dec 12, 2024
@davidbloss davidbloss self-assigned this Dec 12, 2024
@davidbloss davidbloss merged commit 68cbbb0 into main Dec 13, 2024
7 checks passed
@davidbloss davidbloss deleted the db/fix-predicate-validation-bug branch December 13, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

predicate value in opslevel_check_service_property doesn't accept any interpolation nor references
2 participants