Skip to content

Commit

Permalink
r/s3_bucket: set arguments with nil if the Get API method returns an …
Browse files Browse the repository at this point in the history
…empty result
  • Loading branch information
anGie44 committed Feb 4, 2022
1 parent 2494a8d commit aa9d623
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/service/s3/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,8 @@ func resourceBucketRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("website", website); err != nil {
return fmt.Errorf("error setting website: %w", err)
}
} else {
d.Set("website", nil)
}

// Read the versioning configuration
Expand Down Expand Up @@ -1212,6 +1214,9 @@ func resourceBucketRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("replication_configuration", flattenBucketReplicationConfiguration(replication.ReplicationConfiguration)); err != nil {
return fmt.Errorf("error setting replication_configuration: %w", err)
}
} else {
// Still need to set for the non-existent case
d.Set("replication_configuration", nil)
}

// Read the bucket server side encryption configuration
Expand Down

0 comments on commit aa9d623

Please sign in to comment.