Hi all ! For the implementation of the our Pulumi ...
# python
w
Hi all ! For the implementation of the our Pulumi stack, we use the stack file heavily to store the configurations the infrastructure should come up with. Incase there is a misconfiguration in the STACK file, we report what the mistake is. Unfortunately, incase there is a mistake and some decides to move forward with the deployment, pulumi destroys the entire stack, which is the intended behaviour given the fact that it will either bring it up or it will tear it down. Is there a way I could exit the pulumi process incase there is misconfiguration.
b
Hi Sushant. I’m not following this at all, how do you detect misconfigurations in the stack file? you mean the
Pulumi.<stack>.yaml
>
w
Hi Lee ! You are right in
Pulumi.<stack>.yaml
One section of the stack file is something like this
Copy code
vpc:
    create: false
    existing_vpc_details:
      id: XYZ
      cidr-range: 10.0.0.0/16
      public_subnets:
        zone-a: "XYZ"
        zone-b: "XYZ"

      private_subnets:
        zone-a: "XYZ"
        zone-b: "XYZ"

  s3_ingest_config:
    zones:
    - zone-a
    - zone-b

  db_cluster:
    instance_type: db.t3.small
    root_password: XYZ
    launch_reader_writer: false # Set to false for dev/QA setups
    # Minimum 2 zones required: <https://tinyurl.com/3zs4ujvm>
    zones:
    - zone-a
    - zone-b

  cp_live:
    bucket_lifecycle: 30    # in days

  redis:
    instance_type: cache.t3.micro
    password: XYZ
    zones:
    - zone-a
    - zone-b
where in users are allowed to configure the instance type etc. We have validations in place which check if these configurations have been done correctly. In a scenario where the STACK has already been brought up and some one wants to modify something say the RDS Instance type and there is a mistake in the STACK configuration file, our code has been designed in a such a way that the deployment of resources does not proceed but Pulumi treats that as a destroy operation.
b
if you’re able to detect misconfigurations, you can simply log an error: https://www.pulumi.com/docs/intro/concepts/logging/ in ts:
pulumi.log.error("misconfiguration detected!")
which will stop the program from executing
is that what you want?
w
No. I was looking for something like
sys.exit()
in pulumi?
b
It's just python, so why wouldn't you use that?
w
I did. But it did not get picked up
b
Okay without code it'll be hard to debug
w
I understand. If I am able to come up with a simpler version of the issue I ll post here