in rostran/handlers/resource.py [0:0]
def get_ref_id(name, value, reason):
ref_id = None
if (
isinstance(value, dict)
and len(value) == 1
and ("Ref" in value or "Fn::GetAtt" in value)
):
if "Ref" in value:
ref_id = value["Ref"]
if not isinstance(ref_id, str):
typer.secho(
f"The Ref value type of {name} needs to be a string.", fg="yellow"
)
else:
get_att = value["Fn::GetAtt"]
if not isinstance(get_att, list):
typer.secho(
f"The Fn::GetAtt value type of {name} needs to be a list.",
fg="yellow",
)
elif len(get_att) != 2:
typer.secho(
f"The Fn::GetAtt value of {name} needs to be a list of length 2.",
fg="yellow",
)
elif not isinstance(get_att[0], str):
typer.secho(
f"The first element of Fn::GetAtt value of {name} needs to be a string",
fg="yellow",
)
else:
ref_id = get_att[0]
else:
typer.secho(reason, fg="yellow")
return ref_id