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 Condition attribute on resources #8208

Closed
glb opened this issue Sep 9, 2020 · 3 comments · Fixed by #8213 or #8217
Closed

Support Condition attribute on resources #8208

glb opened this issue Sep 9, 2020 · 3 comments · Fixed by #8213 or #8217

Comments

@glb
Copy link
Contributor

glb commented Sep 9, 2020

Use case description

#8139 introduced a schema for AWS Resources. It didn't include the Condition resource attribute.

Similarly, #7352 introduced resources.extensions without support for the Condition attribute.

reference

Proposed solution

Extend the schema for resources and update mergeCustomProviderResources.js to support extending framework-created resources to set the Condition property.

@medikoo
Copy link
Contributor

medikoo commented Sep 10, 2020

@glb great thanks for pointing that. Indeed we missed that, as we were relying on https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-attribute-reference.html which doesn't mention Condition.

It's a pity there's no good source of information which would list all possible top level resources properties.Condition seems to be documented on its own here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html

Anyway PR with a fix is welcome!

@glb
Copy link
Contributor Author

glb commented Sep 10, 2020

@medikoo #8213 only partially fixed the issue; I'll open another PR with the fix for resource.extensions to support the Condition attribute.

@medikoo
Copy link
Contributor

medikoo commented Sep 10, 2020

@medikoo #8213 only partially fixed the issue; I'll open another PR with the fix for resource.extensions to support the Condition attribute.

@glb I take you mean that it's missing here:

case 'CreationPolicy':
case 'DeletionPolicy':
case 'UpdatePolicy':
case 'UpdateReplacePolicy':
template.Resources[resourceName][extensionAttributeName] = value;
break;
case 'Properties':
if (!template.Resources[resourceName].Properties) {
template.Resources[resourceName].Properties = {};
}
Object.assign(template.Resources[resourceName].Properties, value);
break;
case 'DependsOn':
if (!template.Resources[resourceName].DependsOn) {
template.Resources[resourceName].DependsOn = [];
}
template.Resources[resourceName].DependsOn.push(...value);
break;
case 'Metadata':
if (!template.Resources[resourceName].Metadata) {
template.Resources[resourceName].Metadata = {};
}
Object.assign(template.Resources[resourceName].Metadata, value);
break;
Indeed I thought it's only schema where we have this issue.

Looking forward for PR, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment