Skip to content

Commit

Permalink
Merge pull request #23579 from hashicorp/b-s3-bucket-replication-conf…
Browse files Browse the repository at this point in the history
…iguration-filter-tag

r/s3_bucket_replication_configuration: correctly expand and flatten `rule.filter.tag`
  • Loading branch information
anGie44 authored Mar 10, 2022
2 parents 7b6f506 + 424c6ab commit 7fa700c
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .changelog/23579.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_s3_bucket_replication_configuration: Ensure both `key` and `value` arguments of the `rule.filter.tag` configuration block are correctly populated in the outgoing API request and terraform state.
```
6 changes: 3 additions & 3 deletions internal/service/s3/bucket_replication_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func resourceBucketReplicationConfigurationCreate(d *schema.ResourceData, meta i

rc := &s3.ReplicationConfiguration{
Role: aws.String(d.Get("role").(string)),
Rules: ExpandRules(d.Get("rule").(*schema.Set).List()),
Rules: ExpandReplicationRules(d.Get("rule").(*schema.Set).List()),
}

input := &s3.PutBucketReplicationInput{
Expand Down Expand Up @@ -367,7 +367,7 @@ func resourceBucketReplicationConfigurationRead(d *schema.ResourceData, meta int

d.Set("bucket", d.Id())
d.Set("role", r.Role)
if err := d.Set("rule", schema.NewSet(rulesHash, FlattenRules(r.Rules))); err != nil {
if err := d.Set("rule", schema.NewSet(rulesHash, FlattenReplicationRules(r.Rules))); err != nil {
return fmt.Errorf("error setting rule: %w", err)
}

Expand All @@ -379,7 +379,7 @@ func resourceBucketReplicationConfigurationUpdate(d *schema.ResourceData, meta i

rc := &s3.ReplicationConfiguration{
Role: aws.String(d.Get("role").(string)),
Rules: ExpandRules(d.Get("rule").(*schema.Set).List()),
Rules: ExpandReplicationRules(d.Get("rule").(*schema.Set).List()),
}

input := &s3.PutBucketReplicationInput{
Expand Down
Loading

0 comments on commit 7fa700c

Please sign in to comment.