Skip to content

Commit f8f1fb3

Browse files
fix: package.py not found with -chdir option (#136)
1 parent f8887e2 commit f8f1fb3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ def commands_step(path, commands):
670670
# If path doesn't defined for a block with
671671
# commands it will be set to Terraform's
672672
# current working directory
673+
# NB: cwd may vary when using Terraform 0.14+ like:
674+
# `terraform -chdir=...`
673675
path = query.paths.cwd
674676
if batch:
675677
step('sh', path, '\n'.join(batch))

package.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ locals {
77
data "external" "archive_prepare" {
88
count = var.create && var.create_package ? 1 : 0
99

10-
program = [local.python, "${path.module}/package.py", "prepare"]
11-
working_dir = path.cwd
10+
program = [local.python, "${path.module}/package.py", "prepare"]
1211

1312
query = {
1413
paths = jsonencode({
@@ -66,8 +65,7 @@ resource "null_resource" "archive" {
6665
local.python, "${path.module}/package.py", "build",
6766
"--timestamp", data.external.archive_prepare[0].result.timestamp
6867
]
69-
command = data.external.archive_prepare[0].result.build_plan_filename
70-
working_dir = path.cwd
68+
command = data.external.archive_prepare[0].result.build_plan_filename
7169
}
7270

7371
depends_on = [local_file.archive_plan]

0 commit comments

Comments
 (0)