-
Notifications
You must be signed in to change notification settings - Fork 4k
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(servicecatalog): add CloudFormation Parameter constraint #15770
Conversation
Add ability to configure parameter options for when launching a product. Co-authored-by: Dillon Ponzo <dponzo18@gmail.com>
Want to specifically call out how we call the Also scoping down the types for the Cfn Conditions proved more cumbersome than just using the condition interface and adding documentation about what intrinsic functions you can use. |
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.
Want to specifically call out how we call the
formatRules
inassociation-manager.ts
to make sure that that approach is cdk friendly. Seemed like a clean way to do it in typescript but please let us know if there is another avenue that you think is better.
I think it's fine... what specifically were you worried about?
Also scoping down the types for the Cfn Conditions proved more cumbersome than just using the condition interface and adding documentation about what intrinsic functions you can use.
Can you expand why was it cumbersome? I still would like to see this change implemented, so that specifying the wrong function will be a compile-time error.
packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts
Outdated
Show resolved
Hide resolved
// Add dependsOn to force proper order in deployment. | ||
constraint.addDependsOn(association.cfnPortfolioProductAssociation); | ||
} else { | ||
throw new Error(`Provisioning rule ${assertion.ruleName} already configured on association ${this.prettyPrintAssociation(portfolio, product)}`); |
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.
There's some thought to making this override the previous Rule, instead of erroring out.
Maybe an option in constrainProvisioningParameters
?
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.
This is here because in CFN templates you would have all the provisioning rules listed in the same construct, so you can't have overlapping names which are the keys in the map. I broke it apart here like the event notifications, since one would probably only ever add 1-2 rules per product, but I think we still would rather keep unique names in case we need to shift back to that mode of adding all rules in one construct, which would be less of a breaking change if we enforce unique names now. But I don't think someone would want to override rules, usually they would do that with the condition
.
I meant it was going to be cumbersome to fit in this PR. We have been looking at how to modify the interface in |
Fortunately, you made this PR small enough that I don't think adding the changes in Please include these in this PR. |
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.
Looks good overall, but please include the changes mentioned in #15770 (comment) to make providing the functions to the assertions compile-time safe.
packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts
Outdated
Show resolved
Hide resolved
@@ -7,4 +7,4 @@ export function hashValues(...ids: string[]): string { | |||
const sha256 = crypto.createHash('sha256'); | |||
ids.forEach(val => sha256.update(val)); | |||
return sha256.digest('hex').slice(0, 12); | |||
} | |||
} |
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.
Why...?
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.
not sure what/how this snuck in.
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.
Still here 😉.
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.
didn't see what change was but I think this is removed now
bffb25f
to
c927a18
Compare
I am still not sure if this is correct way for implementing the stronger typed assertions, I am still not sure if this is correct, it almost looks like the already existing Edit: Actually I am not sure what exactly the issue was, I think |
* Interface to specify certain functions as rule-specifc. | ||
* These functions can only be used in ``Rules`` section of template. | ||
*/ | ||
export interface ICfnRuleConditionExpression extends ICfnConditionExpression { |
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.
added this
71d4a3f
to
28c6369
Compare
I might've requested review too early, I thought build failed after making |
091631a
to
a586aa8
Compare
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.
Looks great! A few minor notes.
@@ -7,4 +7,4 @@ export function hashValues(...ids: string[]): string { | |||
const sha256 = crypto.createHash('sha256'); | |||
ids.forEach(val => sha256.update(val)); | |||
return sha256.digest('hex').slice(0, 12); | |||
} | |||
} |
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.
Still here 😉.
f64a78a
to
32a7200
Compare
8e73ae6
to
8cc8d28
Compare
b9d6d15
to
f3887ba
Compare
Okay, I tried Codebuild with and without the changes in |
Like I suspected, you need to revert the changes to
|
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.
Looks great!
@@ -228,6 +229,32 @@ portfolio.notifyOnStackEvents(product, topic2, { | |||
}); | |||
``` | |||
|
|||
### CloudFormation parameters constraint | |||
|
|||
CloudFormation parameters constraints allow you to configure the that are available to end users when they launch a product via defined rules. |
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.
Missing word?
CloudFormation parameters constraints allow you to configure the that are available to end users when they launch a product via defined rules. | |
CloudFormation parameters constraints allow you to configure the values that are available to end users when they launch a product via defined rules. |
@@ -604,7 +604,8 @@ class FnCidr extends FnBase { | |||
} | |||
} | |||
|
|||
class FnConditionBase extends Intrinsic implements ICfnConditionExpression { | |||
class FnConditionBase extends Intrinsic implements ICfnRuleConditionExpression { | |||
readonly disambiguator = true; |
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.
Maybe an empty line after this line?
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.
will track for next PR.
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Add ability to configure parameter options for when launching a product.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Co-authored-by: Dillon Ponzo dponzo18@gmail.com