Mac os Sonoma Unable to create a local resource file using Terraform

Hello Everyone,
I just started my basics on terraform session from the Kodekloud platform
I tried practicing it on my local machine ( MacBook Pro, Mac os Sonoma)
As shown in the video I was trying to create a local resource file but the below error has popeup.

Error: Create local file error

│ with,

│ on line 1, in resource “local_file” “pet”:

│ 1: resource “local_file” “pet” {

│ An unexpected error occurred while creating file directory

│ +Original Error: mkdir /Desktop: read-only file system

Any help would be appreciated


It is saying your cannot create the folder Desktop in the root of your filesystem. Try this instead:

filename = "/Users/[your_username]/Desktop/[filename]"