You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce an if condition within the resources section of the stackql_manifest.yml file to enable conditional evaluation of resources during deployment. This feature allows users to specify Python expressions that determine whether a resource should be tested, provisioned, or deprovisioned. The expressions can utilize literals (string, boolean, int, etc.) or reference runtime-templated values from other program variables.
Example(s)
Currently, all resources listed in the stackql_manifest.yml are processed unconditionally. This enhancement allows for conditional processing based on specified criteria. For instance:
Here, the condition compares some_var to the value of some_other_var_value, allowing for dynamic decision-making during deployment.
Possible Approaches or Libraries to Consider
Expression Evaluation: Utilize Python's eval() function to evaluate the conditional expressions. Ensure that the evaluation context includes necessary variables and is secured against potential code injection vulnerabilities.
Template Rendering: Implement a templating mechanism (e.g., using Jinja2) to resolve variables within expressions before evaluation. This allows for dynamic substitution of values and enhances flexibility.
Additional Context
Documentation: Create an if.mdx file in the website/docs/manifest_fields/resources directory, detailing the usage, syntax, and examples of the if condition in resource definitions.
Security Considerations: Carefully handle the evaluation of expressions to prevent security risks associated with arbitrary code execution. Implement validation and sanitization of inputs where necessary.
Testing: Develop unit and integration tests to verify the correct functionality of the conditional evaluation feature under various scenarios and edge cases.
This enhancement will provide users with greater control and flexibility in managing resource deployments, enabling more dynamic and context-sensitive operations within stackql-deploy.
The text was updated successfully, but these errors were encountered:
Feature Description
Introduce an
if
condition within theresources
section of thestackql_manifest.yml
file to enable conditional evaluation of resources during deployment. This feature allows users to specify Python expressions that determine whether a resource should be tested, provisioned, or deprovisioned. The expressions can utilize literals (string
,boolean
,int
, etc.) or reference runtime-templated values from other program variables.Example(s)
Currently, all resources listed in the
stackql_manifest.yml
are processed unconditionally. This enhancement allows for conditional processing based on specified criteria. For instance:In this example, the
get_transfer_kms_key_id
resource will only be processed if theenvironment
variable equals'production'
. Similarly:Here, the condition compares
some_var
to the value ofsome_other_var_value
, allowing for dynamic decision-making during deployment.Possible Approaches or Libraries to Consider
Expression Evaluation: Utilize Python's
eval()
function to evaluate the conditional expressions. Ensure that the evaluation context includes necessary variables and is secured against potential code injection vulnerabilities.Template Rendering: Implement a templating mechanism (e.g., using Jinja2) to resolve variables within expressions before evaluation. This allows for dynamic substitution of values and enhances flexibility.
Additional Context
Documentation: Create an
if.mdx
file in thewebsite/docs/manifest_fields/resources
directory, detailing the usage, syntax, and examples of theif
condition in resource definitions.Security Considerations: Carefully handle the evaluation of expressions to prevent security risks associated with arbitrary code execution. Implement validation and sanitization of inputs where necessary.
Testing: Develop unit and integration tests to verify the correct functionality of the conditional evaluation feature under various scenarios and edge cases.
This enhancement will provide users with greater control and flexibility in managing resource deployments, enabling more dynamic and context-sensitive operations within
stackql-deploy
.The text was updated successfully, but these errors were encountered: