It took me a while, but I finally figured it out.
Here were the issues.
1. The form can not load the contents of the file at run time, nor could it import any external libraries. So the file had to be rendered into a different parameter to start.
2. The groovy version supported by the form was older than I expected. So I could not use any yaml parsers. I needed to convert the yaml output to valid json by replacing all ' with "
3. The fallback script was hard to debug, leading to some false starts. I figured out I could output .size() as a string inside of an array, to debug navigating the yaml turned json properly. In the end, this was the script I used:
import groovy.json.*
def rawText = CLUSTER_MAP
def jsonified = rawText.replaceAll("\'", "\"")
def jslurp = new groovy.json.JsonSlurper().parseText(jsonified)
return jslurp[CLUSTER]