Skip to content

Commit

Permalink
Merge pull request #31931 from hashicorp/e-lambda_event_source_mappin…
Browse files Browse the repository at this point in the history
…g-queues

Add `MaxItems` to `aws_lambda_event_source_mapping.queues`
  • Loading branch information
justinretzolk committed Jun 23, 2023
2 parents 7c1c5dc + 7fccf33 commit f52c3f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/31931.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_lambda_event_source_mapping: The `queues` argument has changed from a set to a list with a maximum of one element.
```
7 changes: 4 additions & 3 deletions internal/service/lambda/event_source_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ func ResourceEventSourceMapping() *schema.Resource {
Computed: true,
},
"queues": {
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringLenBetween(1, 1000),
Expand Down Expand Up @@ -426,8 +427,8 @@ func resourceEventSourceMappingCreate(ctx context.Context, d *schema.ResourceDat
input.ParallelizationFactor = aws.Int64(int64(v.(int)))
}

if v, ok := d.GetOk("queues"); ok && v.(*schema.Set).Len() > 0 {
input.Queues = flex.ExpandStringSet(v.(*schema.Set))
if v, ok := d.GetOk("queues"); ok && len(v.([]interface{})) > 0 {
input.Queues = flex.ExpandStringList(v.([]interface{}))
}

if v, ok := d.GetOk("scaling_config"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/lambda_event_source_mapping.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ resource "aws_lambda_event_source_mapping" "example" {
* `maximum_record_age_in_seconds`: - (Optional) The maximum age of a record that Lambda sends to a function for processing. Only available for stream sources (DynamoDB and Kinesis). Must be either -1 (forever, and the default value) or between 60 and 604800 (inclusive).
* `maximum_retry_attempts`: - (Optional) The maximum number of times to retry when the function returns an error. Only available for stream sources (DynamoDB and Kinesis). Minimum and default of -1 (forever), maximum of 10000.
* `parallelization_factor`: - (Optional) The number of batches to process from each shard concurrently. Only available for stream sources (DynamoDB and Kinesis). Minimum and default of 1, maximum of 10.
* `queues` - (Optional) The name of the Amazon MQ broker destination queue to consume. Only available for MQ sources. A single queue name must be specified.
* `queues` - (Optional) The name of the Amazon MQ broker destination queue to consume. Only available for MQ sources. The list must contain exactly one queue name.
* `scaling_config` - (Optional) Scaling configuration of the event source. Only available for SQS queues. Detailed below.
* `self_managed_event_source`: - (Optional) For Self Managed Kafka sources, the location of the self managed cluster. If set, configuration must also include `source_access_configuration`. Detailed below.
* `self_managed_kafka_event_source_config` - (Optional) Additional configuration block for Self Managed Kafka sources. Incompatible with "event_source_arn" and "amazon_managed_kafka_event_source_config". Detailed below.
Expand Down

0 comments on commit f52c3f7

Please sign in to comment.