func resolveExpression()

in internal/terraform/json.go [177:199]


func resolveExpression(expr map[string]interface{}, plan *plan) interface{} {
	if expr == nil {
		return nil
	}

	if cv, ok := expr["constant_value"]; ok {
		return cv
	}
	if refs, ok := expr["references"]; ok {
		switch stringRefs := refs.(type) {
		case []interface{}:
			for _, ref := range stringRefs {
				if resolved := resolveReference(ref.(string), plan); resolved != nil {
					// Take the first one. Not sure if this is 100% correct.
					return resolved
				}
			}
		}
	}

	// Can't resolve, return expression value as-is.
	return expr
}