Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing AWS targetGroup with pulumi cli #2534

Closed
SergioGenially opened this issue May 25, 2023 · 9 comments
Closed

Error importing AWS targetGroup with pulumi cli #2534

SergioGenially opened this issue May 25, 2023 · 9 comments
Assignees
Labels
area/import An issue related to `pulumi import` or the import resource option. impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/no-repro This issue wasn't able to be reproduced

Comments

@SergioGenially
Copy link

SergioGenially commented May 25, 2023

What happened?

I encountered an error while executing the import command for AWS targetGroup:

pulumi import aws:alb/targetGroup:TargetGroup new-targetgroup arn:aws:elasticloadbalancing:eu-west-1:XXXXXXXX:targetgroup/my_targetGroup/YYYYYYYYYY

The error message received was:

error: anonymous.pp:28,22-29,14: cannot assign expression of type (null) to location of type list({ onDeregistration: output(string) | string, onUnhealthy: output(string) | string } | output({ onDeregistration: string, onUnhealthy: string })) | output(list({ onDeregistration: string, onUnhealthy: string }))?: ;

Expected Behavior

The resource TargetGroup should have been imported correctly without any error.

Steps to reproduce

To reproduce the issue, just execute the targetGroup import command:

pulumi import aws:alb/targetGroup:TargetGroup

Output of pulumi about

pulumi about
CLI          
Version      3.68.0
Go Version   go1.20.4
Go Compiler  gc

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

Backend        
Name           dom
URL            s3://pulumi-state-backends
User           sergio
Organizations  

Additional context

I have attempted to downgrade the Pulumi CLI to previous versions, but I am still encountering the same error.

Contributing

I would like to contribute to the resolution of this issue. Please let me know if there is any guidance or assistance I can provide.

Thank you for your attention to this matter.

@SergioGenially SergioGenially added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels May 25, 2023
@MoralGr
Copy link

MoralGr commented May 25, 2023

It happens exactly the same.
A month ago I imported a target group and it worked, but currently I get that error

@mikhailshilkov
Copy link
Member

@SergioGenially and @MoralGr Thank you for reporting this issue.

I'm trying to reproduce this with all the latest: CLI 3.68.0 and @pulumi/aws 5.41.0. I created a target group with the following repro:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const main = new aws.ec2.Vpc("main", {cidrBlock: "10.0.0.0/16"});
const test = new aws.lb.TargetGroup("test", {
    port: 80,
    protocol: "HTTP",
    vpcId: main.id,
});

And then import the resulting target group as another resource. The command succeeds for me.

I suspect I need to set some other property on my target group to reproduce. Could you please provide more details about your target group configuration, ideally, as a Pulumi program?

Also, which version of the provider are you using?

Thank you!

@mikhailshilkov mikhailshilkov added awaiting-feedback Blocked on input from the author area/import An issue related to `pulumi import` or the import resource option. and removed needs-triage Needs attention from the triage team labels May 27, 2023
@SergioGenially
Copy link
Author

Hello @mikhailshilkov.

We was using @pulumi/aws 5.30.0... After upgrading the plugin to 5.41.0 the import ran successfully.

Thank you so much for your support and sorry for the inconvenience.

@MitchellGerdisch
Copy link

MitchellGerdisch commented Dec 14, 2023

This issue has reappeared starting with v6.7.0 and confirmed in 6.13.3.
The issue does not exist in v6.6.1.

My process:

  • use code sample from above to create a resource
  • create a blank stack
  • `pulumi import aws:alb/targetGroup:TargetGroup import_tg arn:aws:elasticloadbalancing:xxxxxx -y
  • resource imports and then code gen fails as above

@t0yv0 t0yv0 added the impact/regression Something that used to work, but is now broken label Dec 14, 2023
@t0yv0
Copy link
Member

t0yv0 commented Dec 14, 2023

Noting https://github.com/pulumi/pulumi/blob/master/pkg/codegen/hcl2/model/diagnostics.go#L41 possibly where the error is coming from.

@iwahbe iwahbe removed the awaiting-feedback Blocked on input from the author label Feb 2, 2024
@t0yv0 t0yv0 added the p1 A bug severe enough to be the next item assigned to an engineer label Apr 22, 2024
@t0yv0
Copy link
Member

t0yv0 commented Apr 22, 2024

Thank you all, apologies for the experience here, we'll have a look shortly, this sounds like it's something that need to be fixed by an integration test so we stop regressing on it.

@t0yv0
Copy link
Member

t0yv0 commented Apr 23, 2024

#2517 I believe is where this was dealt with before.

@t0yv0
Copy link
Member

t0yv0 commented Apr 23, 2024

6.32.0 - not affected
6.21.0 - not affected
6.18.2 - not affected
6.18.1 - affected
6.18.0 - affected
6.17.0 - affected
6.13.3 - affected

t0yv0 added a commit that referenced this issue Apr 23, 2024
This makes sure that AWS targetGroup can be imported without error.
@t0yv0
Copy link
Member

t0yv0 commented Apr 23, 2024

Adding a regression test in #3859 and closing for now as it appears to be fixed in the latest provider v6.32.0.

@t0yv0 t0yv0 added the resolution/no-repro This issue wasn't able to be reproduced label Apr 23, 2024
@t0yv0 t0yv0 closed this as completed Apr 23, 2024
t0yv0 added a commit that referenced this issue Apr 24, 2024
This makes sure that AWS targetGroup can be imported without error.

It currently passes on the latest version of the provider, but #2534
shows that it had a history of silently regressing. This test will keep
us from regressing this again.

---------

Co-authored-by: VenelinMartinov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/import An issue related to `pulumi import` or the import resource option. impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/no-repro This issue wasn't able to be reproduced
Projects
None yet
Development

No branches or pull requests

6 participants