When using the CLI-driven workflow in Terraform Cloud (TFC) in "remote" execution mode, the Terraform configuration located in the directory is archived and uploaded to TFC. The TFC worker then starts a run using the uploaded configuration.
The configuration directory could contain a number of files that can vary in size, they can be provider binaries or other types of files.
Depending on the size of your configuration the archive creation and its upload can take more time.
In such case it may appear that the run is stuck at :
Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
will stop streaming the logs, but will not stop the plan running remotely.
Preparing the remote plan...
Starting a plan may take a few minutes or more depending on the size of the local directory.
In order to skip the upload of unnecessary files contained in the configuration folder, the
.terraformignore file can be used.
.terraformignore file can include rules as one would include in a .gitignore file
- Comments (starting with
#) or blank lines are ignored
- End a pattern with a forward slash / to specify a directory
- Negate a pattern by starting it with an exclamation point
Note that unlike
.gitignore, only the
.terraformignore at the root of the configuration directory is considered.
Ignoring the unnecessary files helps save time for the upload to TFC.
.terraformignore support was added in Terraform 0.12.11