scottwinkler/terraform-provider-shell

In windows not working properly

Opened this issue · 0 comments

so I am testing with this example code, which is working in Linux but not in Windows:

`provider shell {
interpreter = ["C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", "-c"]
#interpreter = ["/bin/bash", "-c"]
enable_parallelism = false
}

terraform {
required_providers {
shell = {
source = "scottwinkler/shell"
version = "~> 1.7.10"
}
}
}

data "shell_script" "user" {
lifecycle_commands {
read = <<-EOF
echo '{"user" : "bla"}'
EOF
}
}

output "user" {
value = data.shell_script.user.output["user"]
}

resource "shell_script" "github_repository" {
lifecycle_commands {
read = <<-EOF
set -e
echo "{"user": "user1"}"
exit 0
EOF
create = <<-EOF
set -e
echo "{"user": "user2"}"
exit 0
EOF
delete = <<-EOF
set -e
echo '{"user": "user3"}'
exit 0
EOF
update = <<-EOF
set -e
echo '{"user": "user4"}'
exit 0
EOF
}
}

output "userresource" {
value = shell_script.github_repository.output["user"]
}`

In Windows there is always an error:
Error: Attempt to index null value │ │ on main.tf line 56, in output "userresource": │ 56: value = shell_script.github_repository.output["user"] │ ├──────────────── │ │ shell_script.github_repository.output is null │ │ This value is null, so it does not have any indices.

Any suggestions?