问题描述
我正在使用aws cdk生成CF模板。在运行cdk deploy时,出现错误 创建资源失败。预期的params.Item为地图。
代码段:
object GenerateItem()
{
StringBuilder sb = new StringBuilder("{ \"ApiKey\": { \"S\": \"{apiKey}\" },\"HmacSigningKey\": { \"S\": \"{hmacKey}\" },\"Name\": { \"S\": \"{appName}\" } }");
sb.Replace("{apiKey}","SuperSecureAPIKey");
sb.Replace("{hmacKey}","SuperSecureHMACSigningKey");
sb.Replace("{appName}","SuperSecureApp");
return sb.ToString();
}
insertRecord = new AwsSdkCall()
{
Service = "DynamoDB",Action = "putItem",Parameters = new Dictionary<string,object>
{
{ "TableName",Constants.BANKSTATEMENT_API_TOKEN_CONfig_TABLE_NAME },{ "Item",GenerateItem() },},PhysicalResourceId = PhysicalResourceId.Of("InitDynamoDbData")
};
var ps = new PolicyStatement(new PolicyStatementProps
{
Actions = new[] { "*" },Resources = new[] { "*" }
});
// Todo: Writing to database is not working. "Failed to create resource. Expected params.Item to be a map"
var dynamodbWriter = new AwsCustomresource(this,Constants.BANKSTATEMENTAPIAUTH_DYNAMODB_WRITER,new AwsCustomresourceProps
{
OnCreate = insertRecord,Policy = AwsCustomresourcePolicy.FromStatements(new[] { ps })
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)