Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-s3-bucket
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-s3-bucket
Commits
43e845eb
Unverified
Commit
43e845eb
authored
Aug 13, 2021
by
Anton Babenko
Committed by
GitHub
Aug 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Always send `filter` map in replication config (#105)
parent
29de41cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
main.tf
examples/s3-replication/main.tf
+27
-7
main.tf
main.tf
+9
-1
No files found.
examples/s3-replication/main.tf
View file @
43e845eb
...
...
@@ -58,7 +58,7 @@ module "s3_bucket" {
rules
=
[
{
id
=
"
foo
"
id
=
"
something-with-kms-and-filter
"
status
=
"Enabled"
priority
=
10
...
...
@@ -86,25 +86,45 @@ module "s3_bucket" {
}
},
{
id
=
"
ba
r"
id
=
"
something-with-filte
r"
status
=
"Enabled"
priority
=
20
filter
=
{
prefix
=
"two"
tags
=
{
ReplicateMe
=
"Yes"
}
}
destination
=
{
bucket
=
"arn:aws:s3:::
${
local
.
destination_bucket_name
}
"
storage_class
=
"STANDARD"
}
},
{
id
=
"everything-with-filter"
status
=
"Enabled"
priority
=
30
filter
=
{
prefix
=
"two"
tags
=
{
ReplicateMe
=
"Yes"
}
prefix
=
""
}
destination
=
{
bucket
=
"arn:aws:s3:::
${
local
.
destination_bucket_name
}
"
storage_class
=
"STANDARD"
}
},
{
id
=
"everything-without-filters"
status
=
"Enabled"
destination
=
{
bucket
=
"arn:aws:s3:::
${
local
.
destination_bucket_name
}
"
storage_class
=
"STANDARD"
}
},
]
}
...
...
main.tf
View file @
43e845eb
...
...
@@ -172,8 +172,16 @@ resource "aws_s3_bucket" "this" {
}
}
# Send empty map if `filter` is an empty map or absent entirely
dynamic
"filter"
{
for_each
=
length
(
keys
(
lookup
(
rules
.
value
,
"filter"
,
{}
)))
==
0
?
[]
:
[
lookup
(
rules
.
value
,
"filter"
,
{}
)
]
for_each
=
length
(
keys
(
lookup
(
rules
.
value
,
"filter"
,
{}
)))
==
0
?
[{}]
:
[]
content
{}
}
# Send `filter` if it is present and has at least one field
dynamic
"filter"
{
for_each
=
length
(
keys
(
lookup
(
rules
.
value
,
"filter"
,
{}
)))
!
=
0
?
[
lookup
(
rules
.
value
,
"filter"
,
{}
)
]
:
[]
content
{
prefix
=
lookup
(
filter
.
value
,
"prefix"
,
null
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment