我如何 运行 使用 Pulumi 更新每个组件

how can I run updating each component with Pulumi

我正在使用 pulumi,但我遇到了问题。 例如,如果我使用 terraform,我会这样做:

cd terraform/component/${componentName}
terraform workspace new dev
terraform workspace select dev
terraform init -input=true -reconfigre -backend-config "bucket=${bucket_name}" -backend-config "profile=${profile_name}"
terraform apply dev.tfvars

在这种情况下,在 Pulumi 中,我如何指定要更新的脚本文件?

即使我更新 pulumi,index.ts 也会被调用。

我不会指定要更新的脚本文件路径。 文件夹结构就像这里。

src/
    components
        lambda
            main.ts
        ec2
            main.ts

在这种情况下,我想运行像这样。

pulumi up src/components/ec2/main.ts
pulumi up src/components/lambda/main.ts

我不认为你可以用 pulumi 做这样的事情,它会在本地文件夹中寻找 main.ts。你可以做的 - 在你的代码中创建一个配置参数并使用它来定义 pulumi 将采用的代码路径(我正在使用 python,但想法是一样的):

if (config.get("parameter_name") == "path_one"):
    call_function_from_file_1
else:
    call_function_from_file_2