2

I am currently doing some work with the AWS-CDK and I am trying to create a Config Aggregator to aggregate the storage of all of my regions config logs. I am doing this with a region as the source instead of an account because I am not allowed/able to configure organizations. Here is the error I am currently receiving when trying to add props to the code below.

Object literal may only specify known properties, and 'allAwsRegions' does not exist in type 'IResolvable | (IResolvable | AccountAggregationSourceProperty)[]'.ts(2322)

Here is my code:

     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,
    
            }
        });

The error is above is currently coming when I try to use the prop accountIds and give it a value of "awsAccountID" which is assigned its value from the variable you see above. I have not experienced an issue such as this before and would greatly appreciate help!!!

aroe
  • 499
  • 1
  • 6
  • 15

1 Answers1

1

As per the documentation

accountIds  string[]    CfnConfigurationAggregator.AccountAggregationSourceProperty.AccountIds.

In other words you need to pass in an array of strings like so:

const globalAggregator = new config.CfnConfigurationAggregator(this, 'globalAggregator', {
    configurationAggregatorName: 'globalAggregator',
    accountAggregationSources: [{ 
        accountIds: [awsAccountID],   
    }]
});
miensol
  • 39,733
  • 7
  • 116
  • 112
  • When I add that I still get the error as shown above. – aroe Nov 09 '20 at 02:57
  • Type '{ accountIds: string[]; }' is not assignable to type 'IResolvable | (IResolvable | AccountAggregationSourceProperty)[] | undefined'. Object literal may only specify known properties, and 'accountIds' does not exist in type 'IResolvable | (IResolvable | AccountAggregationSourceProperty)[]'.ts(2322) – aroe Nov 09 '20 at 02:57
  • @aroe I've updated the answer after review. I think `accountAggregationSources` needs to be an array as well. – miensol Nov 09 '20 at 07:28
  • perfect I figured this out as well, very strange but it works! Thank you! – aroe Nov 09 '20 at 15:39