Skip to content

aws/notify: Re-align Queue config to AWSCDK #52

@so0k

Description

@so0k

sqs.Queue was one of the first ported constructs and surfaces the underlaying Terraform provider AWS configurations. Mainly because a lot of the core polyfills (i.e. Duration, ...) were missing.

Newer L2 Constructs follow the AWSCDK API closely, reflect the AWSCDK L2 construct... specifically exposing a duration as a number feels very non-intuitive:

new aws.notify.Queue(stack, "Queue", {
namePrefix: "queue.fifo",
messageRetentionSeconds: Duration.days(14).toSeconds(),
visibilityTimeoutSeconds: Duration.minutes(15).toSeconds(),
outputName: "fifo_queue",
registerOutputs: true,
});

The main changes would be:

  1. Do not use JSII Struct Builder:

.mixin(Struct.fromFqn("@cdktf/provider-aws.sqsQueue.SqsQueueConfig"))

  1. Don't pass props directly from L1 to L2 here:

import { SqsQueueConfig, QueuePolicy } from ".";
import { AwsConstructBase, AwsConstructProps } from "../aws-construct";
import * as iam from "../iam";
export interface QueueProps extends AwsConstructProps, SqsQueueConfig {

this.resource = new sqsQueue.SqsQueue(this, "Resource", {
...props,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions