pulumi / pulumi-command

Apache License 2.0
57 stars 23 forks source link

Local command execution failed "Unrecognized field 'addPreviousOutputInEnv' on 'local.CommandInputs'" #440

Closed madhank93 closed 1 month ago

madhank93 commented 1 month ago

What happened?

Running a pulumi up -y -s dev command fails at the local command execution. Error message as follow

Diagnostics:
  command:local:Command (commandResource):
    error: command:local:Command resource 'commandResource': property addPreviousOutputInEnv value {true} has a problem: Unrecognized field 'addPreviousOutputInEnv' on 'local.CommandInputs'

Example

_, err = local.NewCommand(ctx, "commandResource", &local.CommandArgs{
    AddPreviousOutputInEnv: pulumi.Bool(true),
    Create:                 pulumi.String("cat hosts | envsubst > ../py_infra/hosts"),
    Environment: pulumi.StringMap{
        "VOTE_IP":    vote.PrivateIp,
        "RESULT_IP":  result.PrivateIp,
        "WORKER_IP":  worker.PrivateIp,
        "REDIS_IP":   redis.PrivateIp,
        "DB_IP":      db.PrivateIp,
        "BASTION_IP": bastion.PrivateIp,
    },
})
if err != nil {
    return err
}

Output of pulumi about

CLI          
Version      3.107.0
Go Version   go1.22.0
Go Compiler  gc

Plugins
NAME  VERSION
go    unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in go: executable='/usr/local/go/bin/go' version='go version go1.21.3 linux/amd64'

Backend        
Name           madhan
URL            file://~
User           root
Organizations  
Token type     personal

Pulumi locates its logs in /tmp by default
warning: Failed to get information about the Pulumi program's dependencies: load go.mod: open /home/madhan/git/learn-aws-SAA/lab/lab-01/pulumi/go.mod
/home/madhan/git/learn-aws-SAA/lab/lib/go.mod: no such file or directory
warning: Failed to get information about the current stack: No current stack

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

thomas11 commented 1 month ago

Hi @madhank93, could you run pulumi about in the root folder of your Pulumi project? I'd like to know in particular what version of the "command" you're using. If it's not v0.10.0 or v0.11.0, could you upgrade and try again?

madhank93 commented 1 month ago

Hi @thomas11, Thanks for looking into it. After upgrading the pulumi and command plugin it is working now. Thank you!

CLI          
Version      3.116.1
Go Version   go1.22.2
Go Compiler  gc

Plugins
KIND      NAME     VERSION
resource  command  0.11.0
language  go       unknown

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in go: executable='/usr/local/go/bin/go' version='go version go1.21.3 linux/amd64'

Backend        
Name           madhan
URL            file://~
User           root
Organizations  
Token type     personal

Dependencies:
NAME                             VERSION
github.com/pulumi/pulumi/sdk/v3  v3.115.2

Pulumi locates its logs in /tmp by default
warning: Failed to get information about the current stack: No current stack
thomas11 commented 1 month ago

Glad to hear that, @madhank93!