(a *terraform.Attribute, spec *MatchSpec, customCtx *customContext)
| 331 | } |
| 332 | |
| 333 | func evalMatchSpecAttr(a *terraform.Attribute, spec *MatchSpec, customCtx *customContext) bool { |
| 334 | for _, preCondition := range spec.PreConditions { |
| 335 | clone := preCondition |
| 336 | if !evalMatchSpecAttr(a, &clone, customCtx) { |
| 337 | // precondition not met |
| 338 | return true |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | switch spec.Action { |
| 343 | case Not: |
| 344 | return notifyPredicateAttr(a, spec, customCtx) |
| 345 | case And: |
| 346 | return processAndPredicateAttr(a, spec, customCtx) |
| 347 | case Or: |
| 348 | return processOrPredicateAttr(a, spec, customCtx) |
| 349 | default: |
| 350 | if matchFunction, ok := AttrMatchFunctions[spec.Action]; ok { |
| 351 | return matchFunction(a, spec, customCtx) |
| 352 | } else { |
| 353 | return false |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | func notifyPredicate(b *terraform.Block, spec *MatchSpec, customCtx *customContext) bool { |
| 359 | return !evalMatchSpec(b, &spec.PredicateMatchSpec[0], customCtx) |
no test coverage detected