Skip to content

Commit 70b53fc

Browse files
authored
Merge pull request #28602 from brittandeyoung/f-aws_lightsail_instance_add_on
Enhancement: `aws_lightsail_instance` add support for `add_on`
2 parents 74f8794 + 48fdbaf commit 70b53fc

File tree

5 files changed

+485
-211
lines changed

5 files changed

+485
-211
lines changed

.changelog/28602.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_lightsail_instance: Add `add_on` configuration block.
3+
```

internal/service/lightsail/find.go

+22
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,25 @@ func FindBucketById(ctx context.Context, conn *lightsail.Lightsail, id string) (
430430

431431
return out.Buckets[0], nil
432432
}
433+
434+
func FindInstanceById(ctx context.Context, conn *lightsail.Lightsail, id string) (*lightsail.Instance, error) {
435+
in := &lightsail.GetInstanceInput{InstanceName: aws.String(id)}
436+
out, err := conn.GetInstanceWithContext(ctx, in)
437+
438+
if tfawserr.ErrCodeEquals(err, lightsail.ErrCodeNotFoundException) {
439+
return nil, &resource.NotFoundError{
440+
LastError: err,
441+
LastRequest: in,
442+
}
443+
}
444+
445+
if err != nil {
446+
return nil, err
447+
}
448+
449+
if out == nil || out.Instance == nil {
450+
return nil, tfresource.NewEmptyResultError(in)
451+
}
452+
453+
return out.Instance, nil
454+
}

0 commit comments

Comments
 (0)