pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

cannot import existing TargetGroupAttachment

Open smcoll opened this issue 4 years ago • 3 comments

i'm working on splitting a project into two, using stack dependencies, and stuck on a TargetGroupAttachment which doesn't seem to want to import.

$ pulumi up
[...]
Diagnostics:
  aws:lb:TargetGroupAttachment (helloTargetGroupAttachment):
    error: Preview failed: refreshing urn:pulumi:dev::hello::aws:lb/targetGroupAttachment:TargetGroupAttachment::helloTargetGroupAttachment: 1 error occurred:
        * Error reading Target Health: ValidationError: A target group ARN must be specified
        status code: 400, request id: 3f607063-dfa1-46c7-983e-4c63849c6066

My code looks like this:

lb.TargetGroupAttachment("helloTargetGroupAttachment",
    target_group_arn=hello_target_group.arn,
    target_id=hello_fn.arn,
    opts=pulumi.resource.ResourceOptions(
        # depends_on=[hello_target_group, hello_fn],
        import_='arn:aws:elasticloadbalancing:<REGION>:<ACCOUNT>:targetgroup/helloTargetGroup-7e81281/<...>'
    )
)

Removing the _import argument, pulumi up previews an identical state to the state in the original stack (aside from the ID, which doesn't exist yet), so i know the target_group_arn and target_id values are correct. All the related infra is imported successfully.

i also tried a pulumi refresh on the whole stack, but that didn't change the behavior.

smcoll avatar Jan 27 '21 04:01 smcoll

At this time, the provider doesn't support importing target group attachments (https://www.pulumi.com/docs/reference/pkg/aws/lb/targetgroupattachment/#import)

leezen avatar Feb 01 '21 00:02 leezen

@leezen so to split a stack into two stacks, i could do this bit by manually updating the state?

smcoll avatar Feb 01 '21 23:02 smcoll

@smcoll Yes, I think that's likely the best way to go about it right now.

leezen avatar Feb 02 '21 00:02 leezen