You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -62,10 +100,20 @@ The following arguments are supported:
62
100
63
101
-`message_max_size` - (Optional) The maximum size of a message. Should be in bytes. Must be between 1024 and 262_144. Defaults to 262_144.
64
102
103
+
-`dead_letter_queue` - (Optional) Configuration for the dead letter queue. See [Dead Letter Queue](#dead-letter-queue) below for details.
104
+
65
105
-`region` - (Defaults to [provider](../index.md#region)`region`). The [region](../guides/regions_and_zones.md#regions) in which SQS is enabled.
66
106
67
107
-`project_id` - (Defaults to [provider](../index.md#project_id)`project_id`) The ID of the Project in which SQS is enabled.
68
108
109
+
## Dead Letter Queue
110
+
111
+
The `dead_letter_queue` block supports the following:
112
+
113
+
-`id` - (Required) The ID of the dead letter queue. Can be either in the format `{region}/{project-id}/{queue-name}` or `arn:scw:sqs:{region}:project-{project-id}:{queue-name}`.
114
+
115
+
-`max_receive_count` - (Required) The number of times a message is delivered to the source queue before being moved to the dead letter queue. Must be between 1 and 1000.
returnfmt.Errorf("invalid queue ID format for dead-letter queue: %s (expected region/project-id/queue-name or arn:scw:sqs:region:project-id:queue-name)", queueID)
255
+
}
256
+
default:
257
+
scwARN=queueID
258
+
}
259
+
260
+
redrivePolicy:=map[string]any{
261
+
"deadLetterTargetArn": scwARN,
262
+
"maxReceiveCount": maxReceiveCount,
263
+
}
264
+
265
+
jsonData, err:=json.Marshal(redrivePolicy)
266
+
iferr!=nil {
267
+
returnfmt.Errorf("failed to marshal redrive policy: %w", err)
268
+
}
269
+
270
+
s=string(jsonData)
271
+
}
272
+
} else {
273
+
returnfmt.Errorf("unsupported list type for %s", resourcePath)
274
+
}
227
275
default:
228
276
returnfmt.Errorf("unsupported type %s for %s", resourceSchema.Type, resourcePath)
229
277
}
@@ -265,14 +313,47 @@ func awsAttributeToResourceData(values map[string]any, value string, resourcePat
265
313
setResourceValue(values, resourcePath, i, resourceSchemas)
Description: "The maximum size of a message. Should be in bytes.",
108
108
},
109
+
"dead_letter_queue": {
110
+
Type: schema.TypeList,
111
+
Optional: true,
112
+
MaxItems: 1,
113
+
Description: "Configuration for the dead-letter queue",
114
+
Elem: &schema.Resource{
115
+
Schema: map[string]*schema.Schema{
116
+
"id": {
117
+
Type: schema.TypeString,
118
+
Required: true,
119
+
Description: "The ID or ARN of the dead-letter queue where messages are sent after the maximum receive count is exceeded.",
120
+
},
121
+
"max_receive_count": {
122
+
Type: schema.TypeInt,
123
+
Required: true,
124
+
ValidateFunc: validation.IntBetween(1, 1000),
125
+
Description: "The number of times a message is delivered to the source queue before being sent to the dead-letter queue. Must be between 1 and 1,000.",
0 commit comments