// Since we're not even able to attempt a shim here, we'll discard
// the diagnostics we saw so far and let the caller's own error
// handling take care of reporting the invalid expression.
returnexpr,nil
}
// The position handling here isn't _quite_ right because it won't
// take into account any escape sequences in the literal string, but
// it should be close enough for any error reporting to make sense.
srcRange:=expr.Range()
startPos:=srcRange.Start// copy
startPos.Column++// skip initial quote
startPos.Byte++// skip initial quote
traversal,tDiags:=hclsyntax.ParseTraversalAbs(
[]byte(strVal.AsString()),
srcRange.Filename,
startPos,
)
diags=append(diags,tDiags...)
ifwantKeyword{
diags=append(diags,&hcl.Diagnostic{
Severity:hcl.DiagWarning,
Summary:"Quoted keywords are deprecated",
Detail:"In this context, keywords are expected literally rather than in quotes. Previous versions of Terraform required quotes, but that usage is now deprecated. Remove the quotes surrounding this keyword to silence this warning.",
Subject:&srcRange,
})
}else{
diags=append(diags,&hcl.Diagnostic{
Severity:hcl.DiagWarning,
Summary:"Quoted references are deprecated",
Detail:"In this context, references are expected literally rather than in quotes. Previous versions of Terraform required quotes, but that usage is now deprecated. Remove the quotes surrounding this reference to silence this warning.",