github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/cloudformation/parser/fn_condition.go (about)

     1  package parser
     2  
     3  func ResolveCondition(property *Property) (resolved *Property, success bool) {
     4  	if !property.isFunction() {
     5  		return property, true
     6  	}
     7  
     8  	refProp := property.AsMap()["Condition"]
     9  	if refProp.IsNotString() {
    10  		return nil, false
    11  	}
    12  	refValue := refProp.AsString()
    13  
    14  	for k, prop := range property.ctx.Conditions {
    15  		if k == refValue {
    16  			return prop.resolveValue()
    17  		}
    18  	}
    19  
    20  	return nil, false
    21  }