Skip to content

Commit

Permalink
search for stack, fleet and image builder by name instead of listing …
Browse files Browse the repository at this point in the history
…all (#5)

- this will ensure that in accounts that have many stacks, fleets or image builders, we will not hit the max item limit and return indicating that the item does not exist

Co-authored-by: Syed Hussain <[email protected]>
  • Loading branch information
2 people authored and arnvid committed Jun 16, 2021
1 parent afc5024 commit 7fb6674
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion appstream/resource_fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,12 @@ func resourceAppstreamFleetCreate(d *schema.ResourceData, meta interface{}) erro
func resourceAppstreamFleetRead(d *schema.ResourceData, meta interface{}) error {
svc := meta.(*AWSClient).appstreamconn

resp, err := svc.DescribeFleets(&appstream.DescribeFleetsInput{})
var names []*string
fleetName := d.Id()
names = append(names, &fleetName)
describeFleetsInput := appstream.DescribeFleetsInput{Names: names}

resp, err := svc.DescribeFleets(&describeFleetsInput)

if err != nil {
log.Printf("[ERROR] Error reading Appstream Fleet: %s", err)
Expand Down
7 changes: 6 additions & 1 deletion appstream/resource_image_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ func resourceAppstreamImageBuilderRead(d *schema.ResourceData, meta interface{})

svc := meta.(*AWSClient).appstreamconn

resp, err := svc.DescribeImageBuilders(&appstream.DescribeImageBuildersInput{})
var names []*string
imageBuilderName := d.Id()
names = append(names, &imageBuilderName)
describeImageBuildersInput := appstream.DescribeImageBuildersInput{Names: names}

resp, err := svc.DescribeImageBuilders(&describeImageBuildersInput)
if err != nil {
log.Printf("[ERROR] Error describing Appstream Image Builder: %s", err)
return err
Expand Down
7 changes: 6 additions & 1 deletion appstream/resource_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ func resourceAppstreamStackRead(d *schema.ResourceData, meta interface{}) error

svc := meta.(*AWSClient).appstreamconn

resp, err := svc.DescribeStacks(&appstream.DescribeStacksInput{})
var names []*string
stackName := d.Id()
names = append(names, &stackName)
describeStacksInput := appstream.DescribeStacksInput{Names: names}

resp, err := svc.DescribeStacks(&describeStacksInput)
if err != nil {
log.Printf("[ERROR] Error describing stacks: %s", err)
return err
Expand Down

0 comments on commit 7fb6674

Please sign in to comment.