[英]AWS CDK - get ProvisioningArtifactIds from ServiceCatalog product
In CDK I couldn't find from documentation how I can get ProvisioningArtifactIds
eg pa-4abcdjnxjj6ne
?在 CDK 中,我无法从文档中找到如何获取ProvisioningArtifactIds
例如pa-4abcdjnxjj6ne
? CloudFormation will return the value, but not CDK. CloudFormation 将返回值,但不会返回 CDK。
( Edit : in CF, ProductId: !Ref Product
and ProvisioningArtifactId: .GetAtt Product.ProvisioningArtifactIds
) (编辑:在 CF 中, ProductId: !Ref Product
和ProvisioningArtifactId: .GetAtt Product.ProvisioningArtifactIds
)
I need it, so I can make a CloudFormation Product我需要它,所以我可以制作CloudFormation 产品
product = aws_servicecatalog.CloudFormationProduct(self, "Product",
product_name="My Product",
owner="Product Owner",
product_versions=[servicecatalog.CloudFormationProductVersion(
product_version_name="v1",
cloud_formation_template=servicecatalog.CloudFormationTemplate.from_product_stack(S3BucketProduct(self, "S3BucketProduct"))
)])
and later in the same stack make the association然后在同一个堆栈中建立关联
aws_servicecatalog.CfnServiceActionAssociation(
self,
"serviceId",
product_id=product.product_id,
provisioning_artifact_id="????", # ????
service_action_id=myServiceAction.attr_id,
)
The CloudFormation docs list the return values for the resource. CloudFormation 文档列出了资源的返回值。
The !Ref Product
value is easy. !Ref Product
值很简单。 The CDK source code shows it is exposed directly on the L2 CloudFormationProduct
as product_id
. CDK 源代码显示它作为product_id
直接暴露在 L2 CloudFormationProduct
上。
# !Ref Product
ref = product.product_id
The .GetAtt Product.ProvisioningArtifactIds
value is trickier. .GetAtt Product.ProvisioningArtifactIds
值比较棘手。 First reference the underlying L1 CfnCloudFormationProduct
construct with escape hatch syntax.首先使用转义舱口语法引用底层 L1 CfnCloudFormationProduct
构造。 Then call get_att
:然后调用get_att
:
# !GetAtt Product.ProvisioningArtifactIds
cfn_product = product.node.default_child
get_att = cfn_product.get_att("ProvisioningArtifactIds")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.