Skip to content

Commit

Permalink
Merge pull request #36888 from nikhil-goenka/b-aws_lightsail_distribu…
Browse files Browse the repository at this point in the history
…tion

b-aws_lightsail_distribution:attach certificate
  • Loading branch information
jar-b committed Apr 17, 2024
2 parents 53c58d3 + 434ebda commit 9198fc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/36888.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_lightsail_distribution: Fix to properly set `certificate_name` on create and update
```
9 changes: 9 additions & 0 deletions internal/service/lightsail/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ func resourceDistributionCreate(ctx context.Context, d *schema.ResourceData, met
in.IpAddressType = types.IpAddressType(v.(string))
}

if v, ok := d.GetOk("certificate_name"); ok {
in.CertificateName = aws.String(v.(string))
}

out, err := conn.CreateDistribution(ctx, in)

if err != nil {
Expand Down Expand Up @@ -491,6 +495,11 @@ func resourceDistributionUpdate(ctx context.Context, d *schema.ResourceData, met
update = true
}

if d.HasChanges("certificate_name") {
in.CertificateName = aws.String(d.Get("certificate_name").(string))
update = true
}

if d.HasChanges("bundle_id") {
bundleIn.BundleId = aws.String(d.Get("bundle_id").(string))
bundleUpdate = true
Expand Down

0 comments on commit 9198fc2

Please sign in to comment.