pulumi-local icon indicating copy to clipboard operation
pulumi-local copied to clipboard

Config merge

Open lakkeger opened this issue 1 year ago • 0 comments

Motivation

Config merging and respecting the original stack config is not something currently well supported in pulumi-local. To solve this issue, reported on this issue too, we'll introduce 3 different config strategies:

  • overwrite strategy (current, default): this config option simply updates/overwrites the current config with the necessary changes we have to apply for LocalStack
  • override (with dry-run): this config option temporarily creates a config file by merging the original stacks config with our recommended options and running pulumi commands with it. By setting dry-run, pulumi-local creates the config file then terminates without running the command.
  • separation: copying the currently selected stack's config and creates a new separate stack (by default called localstack, however this is configurable with DEFAULT_STACK_NAME env variable)

If any of the config files we'd like to create exists we'll prompt for user input.

Additional options and features

  • DRY_RUN: in cases when makes sense creates the config file but terminates after without modifying it, if it finds an already existing one it prompts the user.
  • --non-interactive/NON_INTERACTIVE: the usage of the non-interactive flag is now allowed to suppress any pulumi-local prompts for user input.
  • LOCAL_STACK_NAME: the name of the LocalStack stack/config file we create, depending on the strategy
  • deactivate aws:accessKey and aws:secretKey options

Changes

  • [x] add user prompt for existing stack configs
  • [x] add logic for strategy selection
  • [x] add merge strategy, by taking leverage of --config-file option of pulumi
  • [x] add separate stack strategy by copying the currently selected stack's config and then change to it
  • [x] deactivate AWS credentials in the config file
  • [x] create tests for strategies

lakkeger avatar Sep 11 '24 08:09 lakkeger