terrakube: Null value in column "workspace_id" of relation "job" violates not-null constraint

Bug description 🐞

If you define a tree structure as follow:

β”œβ”€β”€ modules
β”‚Β Β  └── bucket
β”‚Β Β      β”œβ”€β”€ main.tf
β”œβ”€β”€ staging
β”‚Β Β  β”œβ”€β”€ backend.tf
β”‚Β Β  β”œβ”€β”€ main.tf
β”‚Β Β  β”œβ”€β”€ providers.tf

And you refer to the module in modules from the main.tf in staging/main.tf terrakube plan will crash as follow:

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...

The remote workspace is configured to work with configuration at
/projects/04_my_project/staging/ relative to the target repository.

OpenTofu will upload the contents of the following directory,
excluding files or directories as defined by a .terraformignore file
at /Users/myuser/Repositories/my-repo/.terraformignore (if it is present),
in order to capture the filesystem context the remote workspace expects:
    /Users/myuser/Repositories/myrepo

There was an error connecting to the remote backend. Please do not exit
OpenTofu to prevent data loss! Trying to restore the connection...

Still trying to restore the connection... (3s elapsed)

Steps to reproduce

  • Create the above file structure
  • Create a VCS workspace which working directory points to the staging folder
  • In production folder make sure to refer the module stored in ../modules/my-module
  • Run terraform plan

Expected behavior

It should at least display an error rather than making the API pod crash.

Example repository

No response

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (24 by maintainers)

Most upvoted comments

That’s really strange and annoying! hopefully we wont run into it again !

Thank you anyway !