ariga/terraform-provider-atlas

Apply fails when running in Alpine Linux (musl libc) environment

Closed this issue · 2 comments

I'm trying to run a migration via terraform within a docker environment based on the docker:27.0.2 image, which itself is built on Alpine Linux. I receive the following error:

╷
│ Error: Failed to read migration status
│ 
│   with module.redacted_db.data.atlas_migration.redacted_db,
│   on modules/redacted/migrations.tf line 18, in data "atlas_migration" "redacted_db":
│   18: data "atlas_migration" "redacted_db" {
│ 
│ fork/exec
│ /builds/user/redacted/devops/.terraform/providers/registry.terraform.io/ariga/atlas/0.4.7/linux_amd64/atlas:
│ no such file or directory
╵

I've found that this is occurring because Alpine uses musl libc rather than glibc, and the atlas binary packaged with the terraform provider was compiled against glibc. The binary is definitely present at /builds/user/redacted/devops/.terraform/providers/registry.terraform.io/ariga/atlas/0.4.7/linux_amd64/atlas, but the no such file or directory likely indicates that a shared object can't be found:

$ ldd /builds/user/redacted/devops/.terraform/providers/registry.terraform.io/ariga/atlas/0.4.7/linux_amd64/atlas
	/lib64/ld-linux-x86-64.so.2 (0x7fe35f568000)
	libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fe35f568000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fe35f568000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fe35f568000)
Error relocating /builds/user/redacted/devops/.terraform/providers/registry.terraform.io/ariga/atlas/0.4.7/linux_amd64/atlas: __memcpy_chk: symbol not found
Error relocating /builds/user/redacted/devops/.terraform/providers/registry.terraform.io/ariga/atlas/0.4.7/linux_amd64/atlas: __memset_chk: symbol not found
Error relocating /builds/user/redacted/devops/.terraform/providers/registry.terraform.io/ariga/atlas/0.4.7/linux_amd64/atlas: fcntl64: symbol not found

Eek, I created this issue and then found this: #72
I will upgrade my version and close this ticket if it succeeds.

Success with version 0.5.9. Sorry for the duplicate!