对象字面量只能指定已知属性,并且 'allAwsRegions' 类型不存在 'IResolvable'
Object literal may only specify known properties, and 'allAwsRegions' does not exist in type 'IResolvable'
我目前正在使用 AWS-CDK 做一些工作,我正在尝试创建一个配置聚合器来聚合我所有区域配置日志的存储。我使用区域而不是帐户作为来源来执行此操作,因为我不是 allowed/able 配置组织。这是我在尝试将道具添加到下面的代码时目前收到的错误。
Object literal may only specify known properties, and 'allAwsRegions' does not exist in type 'IResolvable | (IResolvable | AccountAggregationSourceProperty)[]'.ts(2322)
这是我的代码:
const awsRegion = Aws.ACCOUNT_ID.toString()
const awsAccountID = Aws.ACCOUNT_ID.toString()
const globalAggregatorAuth = newconfig.CfnAggregationAuthorization(this,'globalAggregatorAuth',{
authorizedAwsRegion: awsRegion,
authorizedAccountId: awsAccountID,
} )
const globalAggregator = new config.CfnConfigurationAggregator(this, 'globalAggregator', {
configurationAggregatorName: 'globalAggregator',
accountAggregationSources: {
accountIds: awsAccountID,
}
});
当我尝试使用 prop accountIds 并为其赋值“awsAccountID”时,当前会出现上述错误,该值是从您在上面看到的变量中分配的值。我以前从未遇到过这样的问题,非常感谢帮助!!!
accountIds string[] CfnConfigurationAggregator.AccountAggregationSourceProperty.AccountIds.
换句话说,您需要传入一个字符串数组,如下所示:
const globalAggregator = new config.CfnConfigurationAggregator(this, 'globalAggregator', {
configurationAggregatorName: 'globalAggregator',
accountAggregationSources: [{
accountIds: [awsAccountID],
}]
});
我目前正在使用 AWS-CDK 做一些工作,我正在尝试创建一个配置聚合器来聚合我所有区域配置日志的存储。我使用区域而不是帐户作为来源来执行此操作,因为我不是 allowed/able 配置组织。这是我在尝试将道具添加到下面的代码时目前收到的错误。
Object literal may only specify known properties, and 'allAwsRegions' does not exist in type 'IResolvable | (IResolvable | AccountAggregationSourceProperty)[]'.ts(2322)
这是我的代码:
const awsRegion = Aws.ACCOUNT_ID.toString()
const awsAccountID = Aws.ACCOUNT_ID.toString()
const globalAggregatorAuth = newconfig.CfnAggregationAuthorization(this,'globalAggregatorAuth',{
authorizedAwsRegion: awsRegion,
authorizedAccountId: awsAccountID,
} )
const globalAggregator = new config.CfnConfigurationAggregator(this, 'globalAggregator', {
configurationAggregatorName: 'globalAggregator',
accountAggregationSources: {
accountIds: awsAccountID,
}
});
当我尝试使用 prop accountIds 并为其赋值“awsAccountID”时,当前会出现上述错误,该值是从您在上面看到的变量中分配的值。我以前从未遇到过这样的问题,非常感谢帮助!!!
accountIds string[] CfnConfigurationAggregator.AccountAggregationSourceProperty.AccountIds.
换句话说,您需要传入一个字符串数组,如下所示:
const globalAggregator = new config.CfnConfigurationAggregator(this, 'globalAggregator', {
configurationAggregatorName: 'globalAggregator',
accountAggregationSources: [{
accountIds: [awsAccountID],
}]
});