Skip to content

Commit

Permalink
fix: package.py not found with -chdir option (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexedwardjones authored Apr 13, 2021
1 parent f8887e2 commit f8f1fb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@ def commands_step(path, commands):
# If path doesn't defined for a block with
# commands it will be set to Terraform's
# current working directory
# NB: cwd may vary when using Terraform 0.14+ like:
# `terraform -chdir=...`
path = query.paths.cwd
if batch:
step('sh', path, '\n'.join(batch))
Expand Down
6 changes: 2 additions & 4 deletions package.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ locals {
data "external" "archive_prepare" {
count = var.create && var.create_package ? 1 : 0

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

query = {
paths = jsonencode({
Expand Down Expand Up @@ -66,8 +65,7 @@ resource "null_resource" "archive" {
local.python, "${path.module}/package.py", "build",
"--timestamp", data.external.archive_prepare[0].result.timestamp
]
command = data.external.archive_prepare[0].result.build_plan_filename
working_dir = path.cwd
command = data.external.archive_prepare[0].result.build_plan_filename
}

depends_on = [local_file.archive_plan]
Expand Down

0 comments on commit f8f1fb3

Please sign in to comment.