Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: Shared Images Cannot Access LastLaunched (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbernays authored Apr 22, 2022
1 parent 9c67026 commit 5edc917
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/services/ec2/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ func resolveEc2ImageLastLaunchedTime(ctx context.Context, meta schema.ClientMeta
cl := meta.(*client.Client)
image := resource.Item.(types.Image)
svc := cl.Services().EC2
if *image.OwnerId != cl.AccountID {
return nil
}
opts := ec2.DescribeImageAttributeInput{
Attribute: types.ImageAttributeNameLastLaunchedTime,
ImageId: image.ImageId,
Expand Down
3 changes: 3 additions & 0 deletions resources/services/ec2/images_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ec2
import (
"testing"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
"github.com/cloudquery/cq-provider-aws/client"
Expand All @@ -22,6 +23,8 @@ func buildEc2ImagesMock(t *testing.T, ctrl *gomock.Controller) client.Services {
t.Fatal(err)
}

g.OwnerId = aws.String("testAccount")

m.EXPECT().DescribeImages(gomock.Any(), gomock.Any(), gomock.Any()).Return(
&ec2.DescribeImagesOutput{
Images: []types.Image{g},
Expand Down

0 comments on commit 5edc917

Please sign in to comment.