i'm splitting one project into two, by importing e...
# aws
a
i'm splitting one project into two, by importing existing stack resources into the new stack. One has me stumped: i have a TargetGroupAttachment which won't validate.
Copy code
$ pulumi preview --diff
    = aws:lb/targetGroup:TargetGroup: (import)
        [id=arn:aws:elasticloadbalancing:us-east-2:REDACTED:targetgroup/exampleTargetGroup-20b6d5b/REDACTED]
        [urn=urn:pulumi:dev::hello::aws:lb/targetGroup:TargetGroup::exampleTargetGroup]
        [provider=urn:pulumi:dev::hello::pulumi:providers:aws::default_3_20_0::REDACTED]
        healthCheck                   : {
            enabled           : false
            healthyThreshold  : 5
            interval          : 35
            matcher           : "200"
            path              : "/"
            timeout           : 30
            unhealthyThreshold: 2
        }
        lambdaMultiValueHeadersEnabled: false
        name                          : "exampleTargetGroup-20b6d5b"
        targetType                    : "lambda"
[...]
error: Preview failed: refreshing urn:pulumi:dev::hello::aws:lb/targetGroupAttachment:TargetGroupAttachment::exampleTargetGroupAttachment: 1 error occurred:
        * Error reading Target Health: ValidationError: A target group ARN must be specified
        status code: 400, request id: 76b68087-feea-451d-8e22-2770fe1edafa
Code looks like this (and works in the original stack):
Copy code
lb.TargetGroupAttachment("exampleTargetGroupAttachment",
    target_group_arn=example_target_group.arn,
    target_id=example_fn.arn,
    opts=pulumi.resource.ResourceOptions(depends_on=[example_target_group, with_lb, example_fn], import_='arn:aws:elasticloadbalancing:us-east-2:REDACTED:targetgroup/exampleTargetGroup-20b6d5b/REDACTED')
)
Why would it be saying the target group ARN isn't specified?
Seeing that 400, maybe Pulumi is trying to do a health check on the target group and doesn't know to use the _import value rather than the ID (which doesn't exist in the state yet)?