-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Add parameters
getter on GuStack
#1313
Conversation
This is more correct than `getParam` as it return ALL parameters, not just those of type `GuParameter`. As a result the `getParam` and `setParam` functions on `GuStack` are removed. This change also somewhat reduces the utility of `GuParameter`. We might be able to simplify (or even remove!) it.
const parameterKeys = Object.keys(props.stackSetInstance.parameters); | ||
|
||
const undefinedStackSetParams = parameterKeys.filter((_) => !params.includes(_)); | ||
|
||
if (undefinedStackSetParams.length !== 0) { | ||
throw new Error(`There are undefined stack set parameters: ${undefinedStackSetParams.join(", ")}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our current model is to feed stack set instance's parameters from the parent stack, rather than have the stack set instance read from parameter store, as the orchestration of this is tricky.
Here we check that all parameters on the stack set instance also exist on the parent stack, throwing if not.
* | ||
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html | ||
*/ | ||
get parameters(): Record<string, CfnParameter> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today, this is only used in the GuStackSet
construct below.
I would support this as:
|
Attempts at this have failed! Initially I thought Any objections to leaving as is? |
Sorry if I'm missing something obvious, but could we just move the code into
If that's not possible for some reason (or if you don't like the idea!) feel free to leave it as is 👍 |
I'm sure we can do this, I'm just getting a bit confused about how we've named things, which suggests our API for creating stack sets isn't that clear 😬 . I'll merge as is and look to refactor afterwards to simplify. |
What does this change?
This is more correct than
getParam
as it return ALL parameters, not just those of typeGuParameter
. As a result thegetParam
andsetParam
functions onGuStack
are also removed. (There's an argument that this getter could be internal/private to the library - see below.)This change also somewhat reduces the utility of the
GuParameter
construct. We might be able to simplify (or even remove!) it.How to test
CI should continue to pass.
How can we measure success?
Less code, and a more complete API.
Have we considered potential risks?
Although this change removes the
getParam
andsetParam
functions onGuStack
:getParam
,setParam
)GuDistributionBucketParameter
) which is a much simpler APIGiven the above, there might be an argument to make the new
parameters
getter internal to the repository.Checklist
Footnotes
Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs. ↩
If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid? ↩