Skip to content

bug: Pushing a template with a symbolically linked module fails #13203

Closed
@jmshoffs0812

Description

@jmshoffs0812

The link-and-push workflow described in the FAQ fails at least on Coder v2.10.2+a11b169. It appears Coder is not traversing the link itself.

A simple template referencing a linked module directory thus:

module "example-module" {
  source = "./modules/aws-s3-static-website-bucket"
  bucket_name = "foo"
}

Template directory:

➜  example ls -al
total 8
drwxr-xr-x  6 jms staff  192 May  7 14:33 ./
drwxr-xr-x 11 jms staff  352 May  7 14:29 ../
drwxr-xr-x  4 jms staff  128 May  7 14:32 .terraform/
-rw-r--r--  1 jms staff 1406 May  7 14:33 .terraform.lock.hcl
-rw-r--r--  1 jms staff  346 May  7 14:32 main.tf
lrwxr-xr-x  1 jms staff   10 May  7 14:26 modules -> ../modules/

Module directory:

➜  example ls -al modules/
total 0
drwxr-xr-x  3 jms staff  96 Apr 16 19:35 ./
drwxr-xr-x 11 jms staff 352 May  7 14:29 ../
drwxr-xr-x  7 jms staff 224 Apr 16 19:33 aws-s3-static-website-bucket/

Command tar --exclude='.terraform' -cvh . | coder -v templates push -y fails with the following error:

==> ⧗ Detecting persistent resources
2024-05-07 14:42:20.437-04:00 Error: Unreadable module directory
2024-05-07 14:42:20.437-04:00 Unable to evaluate directory symlink: lstat modules: no such file or
2024-05-07 14:42:20.437-04:00 directory
2024-05-07 14:42:20.437-04:00 Error: Unreadable module directory
2024-05-07 14:42:20.437-04:00 The directory  could not be read for module "example-module" at main.tf:10.

Deleting the symlink and requesting Coder to push the same effective structure always succeeds:
rm modules ; cp -R ../modules . ; tar --exclude='.terraform' -cvh . | coder -v templates push -y

And relinking and repeating always fails:
rm -rf modules ; ln -sf ../modules modules ; tar --exclude='.terraform' -cvh . | coder -v templates push -y

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions