Hi @amcgregor101,
When you run an command with remote operations, Terraform CLI will create an archive of a subtree of your local filesystem and upload it to Terraform Cloud, and then Terraform Cloud will in turn then extract that archive in order to create the filesystem to run the remote Terraform CLI inside.
Unless you have overridden things with the .terraformignore
file, Terraform CLI will include all files in the directory except for some special files that are relevant to Terraform CLI itself, inside the .terraform
directory. That should include, for example, arbitrary .js
files you might have included there.
However, since your path includes ../
I expect the problem is instead that the subtree uploaded to Terraform Cloud starts at your current directory and therefore doesn’t include anything from your parent directory, and so ../bin
isn’t present in the remote execution environment at all.
I think the solution to this, then, will be to change your workspace configuration in Terraform Cloud to set a working directory. I can’t see from your question the name of the directory that contains static_site_cdn.tf
, but for the sake of example let’s assume your directory structure is shaped like this:
-
bin
-
cloudfront_function
static_website_request_function.js
-
terraform
That is, that the static_site_cdn.tf
file is inside a directory called terraform
alongside bin
.
In that case, you’d configure the working directory as terraform
, which will then tell Terraform CLI that the configuration for this workspace is in a subdirectory of its filesystem tree, and so it’ll archive and upload the contents of ../
rather than just of the terraform
directory alone.
This mechanism is admittedly a little confusing if you are primarily using Terraform CLI to interact with Terraform Cloud. To help think about it, imagine that Terraform Cloud were instead directly cloning whatever VCS repository these files belong to, and then set the working directory to be whatever subdirectory path is necessary to get from the root of that repository to the directory where the static_site_cdn.tf
file is. Terraform CLI here is attempting to create the effect of cloning that VCS repository, but gathering the files up client-side so that you can work with changes you’ve not necessarily pushed to the remote repository yet.