Hi @stuart-c I am also facing same error can you please look at it.
resource “aws_key_pair” “tf-key” {
key_name = “tf-keypair”
public_key = file(“${path.root}/id_rsa.pub”)
}
error message
Error: Invalid function argument
│
│ on resource.tf line 12, in resource “aws_key_pair” “tf-key”:
│ 12: public_key = file(“${path.root}/id_rsa.pub”)
│ ├────────────────
│ │ while calling file(path)
│ │ path.root is “.”
│
│ Invalid value for “path” parameter: no file exists at “./id_rsa.pub”; this
│ function works only with files that are distributed as part of the
│ configuration source code, so if this file will be created by a resource in
│ this configuration you must instead obtain this result from an attribute of
│ that resource.