Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions internal/provider/resource_local_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ func resourceLocalFile() *schema.Resource {
}

func resourceLocalFileRead(d *schema.ResourceData, _ interface{}) error {
// If the output file doesn't exist, mark the resource for creation.
// If the output file doesn't exist or cannot be read due to permission
// issues, mark the resource for creation.
outputPath := d.Get("filename").(string)
if _, err := os.Stat(outputPath); os.IsNotExist(err) {
if _, err := os.Stat(outputPath); os.IsNotExist(err) || os.IsPermission(err) {
d.SetId("")
return nil
}
Expand Down