j

    jolly-alligator-19698

    6 months ago
    Hello. I'm trying to create a cloudwatch EventTarget and am getting this less-than-helpful error message:
    Creating EventBridge Target failed: ValidationException: Parameter(s) EcsParameters not supported for target
    Here's the resource code. Is there an error in the code? Or a way to get more information about the failure? Thank you.
    const eventTarget = pulumi.all([subnetIds.ids, taskDefinition.taskDefinition.arn, deadLetterQueue.arn])
        .apply(([subnetIds, taskDefinitionArn, deadLetterQueueArn]) => new aws.cloudwatch.EventTarget("event-target", {
            arn: deadLetterQueueArn,
            name: `${pulumi.getProject()}-event-target`,
            description: genericDescription,
            ecsTarget: {
                taskDefinitionArn: taskDefinitionArn,
                enableEcsManagedTags: true,
                enableExecuteCommand: true,
                group: pulumi.getProject(),
                launchType: "FARGATE",
                networkConfiguration: {
                    assignPublicIp: false,
                    securityGroups: [securityGroupId],
                    subnets: subnetIds,
                },
                platformVersion: "1.4.0",
                taskCount: 1,
            },
            eventBusName: "default",
            retryPolicy: {
                maximumEventAgeInSeconds: 60,
                maximumRetryAttempts: 1,
            },
            rule: eventRule.name,
        }, {provider: targetAwsProvider}));
    The inputs are fine:
    pulumi.all([subnetIds.ids, taskDefinition.taskDefinition.arn, deadLetterQueue.arn])
        .apply(([subnetIds, taskDefinitionArn, deadLetterQueueArn]) => console.log([subnetIds, taskDefinitionArn, deadLetterQueueArn]))
    console.log(securityGroupId)
    yields
    sg-<redacted>
        [
          [ 'subnet-<redacted>', 'subnet-<redacted>' ],
          'arn:aws:ecs:us-east-2:<redacted>:task-definition/task-definition-<redacted>:3',
          'arn:aws:sqs:us-east-2:<redacted>:<redacted>'
        ]
    s

    stocky-restaurant-98004

    6 months ago
    Can you post the event rule?
    I believe the problem is the
    arn
    - that should point to the target ECS cluster.
    There's an example in the TF docs that gets dropped by our conversion process for reasons we would need to investigate (and fix), but that's how I figured it out: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target#example-ecs-run-task-w[…]and-task-override-usage
    Folks running into difficulties because of dropped examples in the docs is a common issue with our users and a current area of focus for us. When you have a minute, please let me know if the solution worked for you.
    j

    jolly-alligator-19698

    6 months ago
    Will update, thanks!
    const eventRule = new aws.cloudwatch.EventRule("event-rule", {
        name: `${pulumi.getProject()}-event-rule`,
        description: genericDescription,
        eventBusName: "default",
        scheduleExpression: "cron(1 0 * * ? *)",
    }, {provider: targetAwsProvider});
    Yes, the
    eventTarget.d.ts
    docs define
    arn
    as
    ARN of the SQS queue specified as the target for the dead-letter queue.
    success! Updating the
    arn
    to the cluster arn allowed the resource creation to finish. Thank you @stocky-restaurant-98004
    s

    stocky-restaurant-98004

    6 months ago
    You're most welcome!