According to this issue, the local_file resource does not work as one would expect when using Terraform Cloud.
Is there a way to actually generate local files on the machine I’m running terraform plan on when using Terraform Cloud as the execution environment? Seems since I’m running the tool locally, there should be a way of still creating a local resource.
I’m a bit late, but this might help anyone who is still encountering the same issue.
To fix this, you can change the execution mode of your workspace:
-
Go to Terraform Cloud.
-
Open your workspace.
-
Navigate to Settings → General.
-
Under Execution Mode, select Local.
With local execution enabled, your terraform plan and terraform apply will run on your own machine, and local_file resources will be created on your local filesystem.
In this mode, HCP Terraform is only used to store and synchronize the state.