fix(inputs.cloudwatch): Ensure account list is larger than index (#15428)

This commit is contained in:
Joshua Powers 2024-05-31 02:34:31 -06:00 committed by GitHub
parent 58aae6201b
commit 042b257b64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -378,7 +378,7 @@ func (c *CloudWatch) getDataQueries(filteredMetrics []filteredMetric) map[string
id := strconv.Itoa(j) + "_" + strconv.Itoa(i)
dimension := ctod(metric.Dimensions)
var accountID *string
if c.IncludeLinkedAccounts {
if c.IncludeLinkedAccounts && len(filtered.accounts) > j {
accountID = aws.String(filtered.accounts[j])
(*dimension)["account"] = filtered.accounts[j]
}