Skip to content

Don't set Pdeathsig when running inside aws lambda #172

Open
@danieleva

Description

@danieleva

When running tfexec inside a aws lambda any command dies with a cryptic error:
fork/exec /var/task/terraform: operation not permitted: PathError.
The issue is in tfexec/cmd_linux.go, setting Pdeathsig is not allowed in the lambda runtime and the execution is blocked.
I understand running terraform inside a lambda is not a recommended pattern but I find it really handy for modules that don't take too long to apply (15 mins max runtime).
The fix itself is simple enough and doesn't affect non-lambda linux runtimes: check for lambda runtime before setting SysProcAttr

	if _, ok := os.LookupEnv("LAMBDA_TASK_ROOT"); !ok {
		cmd.SysProcAttr = &syscall.SysProcAttr{
			// kill children if parent is dead
			Pdeathsig: syscall.SIGKILL,
			// set process group ID
			Setpgid: true,
		}
	}

Would you be interested in a PR to address this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions