diff --git a/docs-chef-io/content/inspec/resources/aws_cloudwatch_log_group.md b/docs-chef-io/content/inspec/resources/aws_cloudwatch_log_group.md index 41ec63b58..80c3b7c94 100644 --- a/docs-chef-io/content/inspec/resources/aws_cloudwatch_log_group.md +++ b/docs-chef-io/content/inspec/resources/aws_cloudwatch_log_group.md @@ -41,6 +41,11 @@ end : This resource accepts a single parameter, the log group name which uniquely identifies the CloudWatch Log Group. This can be passed either as a string or as a `log_group_name: 'value'` key-value entry in a hash. +`limit` _(optional)_ + +: This resource accepts a single parameter, an integer representing the number of results allowed to return. If not passed, in, this defaults to `1`, which will only return the first match to the `log_group_name`. + This can be passed as a `limit: 'value'` key-value entry in a hash. + ## Properties `retention_in_days` diff --git a/libraries/aws_cloudwatch_log_group.rb b/libraries/aws_cloudwatch_log_group.rb index 6cb1cd1b6..5fe64071e 100644 --- a/libraries/aws_cloudwatch_log_group.rb +++ b/libraries/aws_cloudwatch_log_group.rb @@ -6,7 +6,7 @@ class AwsCloudWatchLogGroup < AwsResourceBase name 'aws_cloudwatch_log_group' desc 'Verifies settings for an AWS CloudWatch Log Group.' - attr_reader :log_group_name, :retention_in_days, :metric_filter_count, :kms_key_id, :tags, :arn + attr_reader :log_group_name, :limit, :retention_in_days, :metric_filter_count, :kms_key_id, :tags, :arn def initialize(opts = {}) opts = { log_group_name: opts } if opts.is_a?(String) @@ -18,9 +18,10 @@ def initialize(opts = {}) end @log_group_name = opts[:log_group_name] + @limit = opts[:limit] ? opts[:limit].to_i : 1 catch_aws_errors do - resp = @aws.cloudwatchlogs_client.describe_log_groups({ log_group_name_prefix: @log_group_name }) + resp = @aws.cloudwatchlogs_client.describe_log_groups({ log_group_name_prefix: @log_group_name, limit: @limit }) @log_groups = resp.log_groups end