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

     1  package parser
     2  
     3  import (
     4  	"github.com/aquasecurity/trivy-iac/pkg/scanners/cloudformation/cftypes"
     5  )
     6  
     7  func ResolveEquals(property *Property) (resolved *Property, success bool) {
     8  	if !property.isFunction() {
     9  		return property, true
    10  	}
    11  
    12  	refValue := property.AsMap()["Fn::Equals"].AsList()
    13  
    14  	if len(refValue) != 2 {
    15  		return abortIntrinsic(property, "Fn::Equals should have exactly 2 values, returning original Property")
    16  	}
    17  
    18  	propA, _ := refValue[0].resolveValue()
    19  	propB, _ := refValue[1].resolveValue()
    20  	return property.deriveResolved(cftypes.Bool, propA.EqualTo(propB.RawValue())), true
    21  }