Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support UsePreviousValue in parameters #77

Closed
nathanreynolds-kcom opened this issue Mar 8, 2017 · 6 comments
Closed

Support UsePreviousValue in parameters #77

nathanreynolds-kcom opened this issue Mar 8, 2017 · 6 comments

Comments

@nathanreynolds-kcom
Copy link

nathanreynolds-kcom commented Mar 8, 2017

CD scripts can update e.g ECS image refs with CloudFormation's UsePreviousValue flag. This ensures only the defined parameter is updated.

It'd be useful if Sceptre supported the same, to be sure we don't revert such changes on the next update-stack.

cfn-sphere has something similar in it's KeepOrUse macro.

@nathanreynolds-kcom
Copy link
Author

nathanreynolds-kcom commented Mar 8, 2017

Implementation-wise, could allow stack config parameters to accept dicts, e.g:

parameters:
  regular_style: 'my_value'
  verbose_style:
    value: 'my_value'
    use_previous_value: true

Stack._format_parameters may have to accept extra context, informing whether it's a create or update. If an update and use_previous_value is set, pass {"ParameterKey": ..., "UsePreviousValue": true} - otherwise, use the current behaviour.

@theseanything
Copy link
Contributor

Hi @Nathkc,
Not sure I see a strong use case for this. All your parameter values are documented with the stack_config yaml file - so if you update your stack you should be passing the previous values anyway. Do you have a particular example of where/how this functionality is needed?

@nathanreynolds-kcom
Copy link
Author

nathanreynolds-kcom commented Mar 16, 2017

No problem, I'll do my best.


We have two teams: infrastructure and development.

Infrastructure have deployed a stack. Development now push AMI updates with:

  • aws cloudformation update-stack --stack-name dev --use-previous-template --parameters ParameterKey=ami,ParameterValue=ami-xyz123

This only changes a parameter. It doesn't change the template, which is important:

  • Minimal training for development team.
  • No unwanted infrastructure changes from old branches / faulty merges.
  • Infrastructure reasonably decoupled from development. Each team can independently improve their process.

Now infrastructure needs to update the stack.

Remember the development team hasn't updated the stack source. If we blindly deploy, it'll revert their changes.

Our options are:

  1. Commit development parameter changes to the infrastructure repo. We don't want this for the previous reasons.
  2. Merge in current parameter values before updating stack. That's where UsePreviousValue comes in.

@theseanything
Copy link
Contributor

Hi @Nathkc, thanks for that! Personally, my opinion the issue is you have multiple deployment methods - AWS CLI and Sceptre. I recommend trying to stick to a single method across your teams- and possibly using Sceptre with in a CI/CD pipeline to automatically push AMI changes. It may also be advantageous to create a custom resolver to dynamically pick up the new AMI ID that is created by your developers.

@et304383
Copy link

@theseanything here's a valid use case:

Input parameter for RDS master password that comes from an environment variable or var argument.

I want to provide this on create, but use previous value on update.

@alex-harvey-z3q
Copy link
Contributor

If anyone ever wants to reopen this, a PR was sent in that was never merged
#1476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants