Skip to content

Commit

Permalink
r/s3_bucket_replication_configuration: fix tests while we're here
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 committed Feb 7, 2022
1 parent 0d4c161 commit fe9084c
Showing 1 changed file with 61 additions and 8 deletions.
69 changes: 61 additions & 8 deletions internal/service/s3/bucket_replication_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsNonEmptyFilter(
Config: testAccBucketReplicationConfigurationWithMultipleDestinationsNonEmptyFilter(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckBucketReplicationConfigurationExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "rule.#", "2"),
resource.TestCheckResourceAttr(resourceName, "rule.#", "3"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{
"id": "rule1",
"priority": "1",
Expand All @@ -212,10 +212,24 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsNonEmptyFilter(
"priority": "2",
"status": s3.ReplicationRuleStatusEnabled,
"filter.#": "1",
"filter.0.prefix": "prefix2",
"filter.0.tag.#": "1",
"filter.0.tag.0.key": "Key2",
"filter.0.tag.0.value": "Value2",
"destination.#": "1",
"destination.0.storage_class": s3.StorageClassStandardIa,
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{
"id": "rule3",
"priority": "3",
"status": s3.ReplicationRuleStatusDisabled,
"filter.#": "1",
"filter.0.and.#": "1",
"filter.0.and.0.prefix": "prefix3",
"filter.0.and.0.tags.%": "1",
"filter.0.and.0.tags.Key3": "Value3",
"destination.#": "1",
"destination.0.storage_class": s3.StorageClassOnezoneIa,
}),
),
},
{
Expand Down Expand Up @@ -1018,10 +1032,14 @@ resource "aws_s3_bucket_replication_configuration" "test" {
}

func testAccBucketReplicationConfigurationRTC(rName string) string {
return acctest.ConfigCompose(testAccBucketReplicationConfigurationBase(rName),
return acctest.ConfigCompose(
testAccBucketReplicationConfigurationBase(rName),
`
resource "aws_s3_bucket_replication_configuration" "test" {
depends_on = [aws_s3_bucket_versioning.source]
depends_on = [
aws_s3_bucket_versioning.source,
aws_s3_bucket_versioning.destination
]
bucket = aws_s3_bucket.source.id
role = aws_iam_role.test.arn
Expand Down Expand Up @@ -1206,7 +1224,12 @@ resource "aws_s3_bucket_versioning" "destination3" {
}
resource "aws_s3_bucket_replication_configuration" "test" {
depends_on = [aws_s3_bucket_versioning.source]
depends_on = [
aws_s3_bucket_versioning.source,
aws_s3_bucket_versioning.destination,
aws_s3_bucket_versioning.destination2,
aws_s3_bucket_versioning.destination3
]
bucket = aws_s3_bucket.source.id
role = aws_iam_role.test.arn
Expand Down Expand Up @@ -1236,18 +1259,45 @@ resource "aws_s3_bucket_replication_configuration" "test" {
status = "Enabled"
filter {
prefix = "prefix2"
tag {
key = "Key2"
value = "Value2"
}
}
delete_marker_replication {
status = "Enabled"
status = "Disabled"
}
destination {
bucket = aws_s3_bucket.destination2.arn
storage_class = "STANDARD_IA"
}
}
rule {
id = "rule3"
priority = 3
status = "Disabled"
filter {
and {
prefix = "prefix3"
tags = {
Key3 = "Value3"
}
}
}
delete_marker_replication {
status = "Disabled"
}
destination {
bucket = aws_s3_bucket.destination3.arn
storage_class = "ONEZONE_IA"
}
}
}`, rName))
}

Expand Down Expand Up @@ -1750,7 +1800,10 @@ resource "aws_s3_bucket_replication_configuration" "test" {
func testAccBucketReplicationConfiguration_schemaV2DestinationMetrics_statusOnly(rName, storageClass string) string {
return testAccBucketReplicationConfigurationBase(rName) + fmt.Sprintf(`
resource "aws_s3_bucket_replication_configuration" "test" {
depends_on = [aws_s3_bucket_versioning.source]
depends_on = [
aws_s3_bucket_versioning.source,
aws_s3_bucket_versioning.destination
]
bucket = aws_s3_bucket.source.id
role = aws_iam_role.test.arn
Expand Down

0 comments on commit fe9084c

Please sign in to comment.