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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when ec2.LookupAmiOutput finds no matching results #8107

Closed
Tracked by #13503
t0yv0 opened this issue Sep 30, 2021 · 2 comments
Closed
Tracked by #13503

Panic when ec2.LookupAmiOutput finds no matching results #8107

t0yv0 opened this issue Sep 30, 2021 · 2 comments
Assignees
Labels
area/codegen SDK-gen, program-gen, convert impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec language/go resolution/fixed This issue was fixed
Milestone

Comments

@t0yv0
Copy link
Member

t0yv0 commented Sep 30, 2021

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)

Issue details

ec2.LookupAmiOutput panics when the user-specified filters result in no AMIs being found.

package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		res := ec2.LookupAmiOutput(ctx, ec2.LookupAmiOutputArgs{
			Filters: ec2.GetAmiFilterArray{
				ec2.GetAmiFilterArgs{
					Name: pulumi.String("name"),
					// use "Cloud9AmazonLinux2-*" to get a valid result
					Values: pulumi.StringArray{pulumi.String("Cloud9AmazonLinux3-*")},
				},
			},
			MostRecent: pulumi.Bool(true),
			Owners:     pulumi.StringArray{pulumi.String("amazon")},
		})

		ctx.Export("arn", res.Arn())
		return nil
	})
}

Steps to reproduce

Expected: recoverable error or empty result
Actual: panic

Filing it here rather than in pulumi/pulumi-aws as this might be an issue with handling errors in the newly introduced $fnOutput helper feature, the older plain version of the invoke LookupAmi is better behaved here.

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec language/go area/codegen SDK-gen, program-gen, convert needs-triage Needs attention from the triage team labels Sep 30, 2021
@emiliza emiliza added impact/panic This bug represents a panic or unexpected crash and removed needs-triage Needs attention from the triage team labels Oct 1, 2021
@justinvp justinvp mentioned this issue Jul 26, 2023
46 tasks
@dixler
Copy link
Contributor

dixler commented Jul 27, 2023

I was able to repro this error on github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2 so I should be able to identify the issue.

This appears fixed on the latest v5 of the aws provider. (github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2)
asciicast

@dixler dixler self-assigned this Jul 27, 2023
@dixler dixler added this to the 0.92 milestone Jul 27, 2023
@dixler dixler added the resolution/duplicate This issue is a duplicate of another issue label Jul 27, 2023
@dixler
Copy link
Contributor

dixler commented Jul 27, 2023

@dixler dixler closed this as completed Jul 27, 2023
@dixler dixler added resolution/fixed This issue was fixed and removed resolution/duplicate This issue is a duplicate of another issue labels Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen SDK-gen, program-gen, convert impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec language/go resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants