Search code examples
pulumi

how can I run updating each component with Pulumi


I'm using pulumi, but I have a problem. for example, if I use terraform, I would do this:

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

in that cases, in Pulumi, how can I specify script file to update?

even if I update pulumi, index.ts will be invoked.

I wont to specify script file path to update. folder structure is like here.

src/
    components
        lambda
            main.ts
        ec2
            main.ts

in this cases, I want to run something like this.

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

Solution

  • I dont think you can do something like this with pulumi, it looks for the main.ts in the local folder. What you can do - is create a config parameter in your code and use that to define which code path pulumi will take (I'm using python, but the idea is the same):

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