Local_file resource query

After following the lecture on local_file resource type, I created a file using the same on my local machine, but after terraform apply, I am getting an Error: open /root/test_terra.txt: permission denied. Please help with the same!

Hello @paridua120,

Can you share your terraform file and the screenshot of how did you apply it along with error message?


Screenshot from 2022-11-21 20-37-34

Screenshot from 2022-11-21 20-38-14

Hello paridua120,
you’re trying to create a file under the root user and your current user doesn’t have enough permission to create it. So, you can change the path to your current user "like /home/YOUR-USER/test_terra.txt. or make sure that the current user has a sudo permission, the run sudo terraform apply

Thank you so much, Ayman. That was a silly mistake. Now it is working.

1 Like