(servicecatalog): Optional fields for `CloudFormationProduct` do not synth in template for python
See original GitHub issueWhat is the problem?
According to the generated docs for python (and also the analogous ts experience) , we should be able to create a product like so:
# Example automatically generated. See https://github.com/aws/jsii/issues/826
product = servicecatalog.CloudFormationProduct(self, "MyFirstProduct",
product_name="My Product",
owner="Product Owner",
product_versions=[{
"product_version_name": "v1",
"cloud_formation_template": servicecatalog.CloudFormationTemplate.from_url("https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/ServiceCatalog/Product.yaml")
}
]
)
The product_versions
field takes a list of these dict objects. The fields product_version_name
and product_version_description
are both optional. However, if even if you include them they do not appear in the synthed template:
ProvisioningArtifactParameters:
DisableTemplateValidation: false
Info:
LoadTemplateFromURL: https://www.google.com
Somehow in these fields being optional they are getting cast to None
somewhere. There is a workaround which is to initialize background class CloudFormationProductVersion
directly like so:
product_versions=[
sc.CloudFormationProductVersion(
cloud_formation_template = sc.CloudFormationTemplate.from_url('https://www.example.com/file.yaml'),
product_version_name = 'test',
description = 'test_description',
),
]
Need to figure out why the optional fields are somehow being discarded from the template so that passing in fields works as expected.
Reproduction Steps
Included above, but copy from the README example:
# Example automatically generated. See https://github.com/aws/jsii/issues/826
product = servicecatalog.CloudFormationProduct(self, "MyFirstProduct",
product_name="My Product",
owner="Product Owner",
product_versions=[{
"product_version_name": "v1",
"cloudFormationTemplate": servicecatalog.CloudFormationTemplate.from_url("https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/ServiceCatalog/Product.yaml")
}]
)
Will not include the name field in template
What did you expect to happen?
Expected product_version_name
and product_version_description
fields to be reflected in the generated template
What actually happened?
The fields did not generate in the template at all.
CDK CLI Version
1.130.0
Framework Version
No response
Node.js Version
12.22.3
OS
Mac
Language
Python
Language Version
3.7
Other information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Yeah we can close this, the newer docs have correct syntax.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.