Skip to content

Add stack_master validate --no-validate-template-parameters option#331

Merged
orien merged 2 commits intomasterfrom
no-validate-template-parameters
May 7, 2020
Merged

Add stack_master validate --no-validate-template-parameters option#331
orien merged 2 commits intomasterfrom
no-validate-template-parameters

Conversation

@orien
Copy link
Copy Markdown
Member

@orien orien commented May 1, 2020

Since version 2.4.0 and #323, the stack_master validate validates the presence of template parameter values. This new feature is valuable, has the potential to cause pain in the upgrade process as it:

  • attempts to resolve parameters
  • requires extra IAM permissions, depending on the parameter resolving features used by the given stack

To ease the upgrade path, I propose an option to disable this new functionality.

stack_master validate --no-validate-template-parameters <region> <stack>

Comment thread lib/stack_master/cli.rb
c.option '--yes-param PARAM_NAME', String, "Auto-approve stack updates when only parameter PARAM_NAME changes"
c.action do |args, options|
options.defaults config: default_config_file
options.default config: default_config_file
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default option values are specified via the default method.

Comment thread lib/stack_master/cli.rb
c.option '--[no-]validate-template-parameters', 'Validate template parameters. Default: validate'
c.action do |args, options|
options.defaults config: default_config_file
options.default config: default_config_file, validate_template_parameters: true
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With no option specified, resolve and validate the template parameters.

Comment thread lib/stack_master/stack.rb
stack_policy_body: stack_policy_body)
end

def self.generate_without_parameters(stack_definition, config)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new way to generate a Stack instance without resolving template parameters.

Copy link
Copy Markdown

@intuxicated intuxicated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Copy Markdown
Contributor

@petervandoros petervandoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👏 👍 with an optional nitpick comment for your consideration.

Comment thread lib/stack_master/stack.rb
stack_policy_body: stack_policy_body)
end

def self.generate_without_parameters(stack_definition, config)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given compile time parameters are resolved, consider renaming the method to be slightly more accurate. Perhaps something like generate_without_template_parameters?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in two minds about this. The Stack instance this generates has a parameters property which only includes the template parameters. Compile-time parameters don't seem to be a thing once the Stack instance has been generated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in two minds about this. The Stack instance this generates has a parameters property which only includes the template parameters.

Happy to leave it as is. I don't feel strongly about it 😄 .

Compile-time parameters don't seem to be a thing once the Stack instance has been generated.

Correct. They're used to generate the template. Template parameters are part of the template and evaluated at apply time by the CloudFormation service.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

I think I'll leave it as is. Differentiating between the two types of parameters here seems to be exposing internal implementation of the method. The output Stack instance names the template parameters, 'parameters', so I'll follow that convention.

@orien orien requested review from patrobinson and stevehodgkiss May 1, 2020 07:26
@orien orien merged commit 95b0bf1 into master May 7, 2020
@orien orien deleted the no-validate-template-parameters branch May 7, 2020 23:49
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

Successfully merging this pull request may close these issues.

4 participants