Skip to content

Commit

Permalink
feat: Added Replication Time Control for Bucket Replication (terrafor…
Browse files Browse the repository at this point in the history
  • Loading branch information
schniber authored Nov 7, 2021
1 parent 209fd2f commit fa1defc
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ repos:
# entry: /Users/Bob/Sites/terraform-aws-modules/scripts/generate-terraform-wrappers.sh --module-dir modules/notification --overwrite
# language: system
# pass_filenames: false
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.55.0
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand All @@ -37,7 +37,7 @@ repos:
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-merge-conflict
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ inputs = {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.50 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.50 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.64 |

## Modules

Expand Down
6 changes: 3 additions & 3 deletions examples/s3-replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.50 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.50 |
| <a name="provider_aws.replica"></a> [aws.replica](#provider\_aws.replica) | >= 3.50 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.64 |
| <a name="provider_aws.replica"></a> [aws.replica](#provider\_aws.replica) | >= 3.64 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
10 changes: 9 additions & 1 deletion examples/s3-replication/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ module "s3_bucket" {
access_control_translation = {
owner = "Destination"
}
replication_time = {
status = "Enabled"
minutes = 15
}
metrics = {
status = "Enabled"
minutes = 15
}
}
},
{
Expand Down Expand Up @@ -128,4 +136,4 @@ module "s3_bucket" {
]
}

}
}
2 changes: 1 addition & 1 deletion examples/s3-replication/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.50"
aws = ">= 3.64"
random = ">= 2.0"
}
}
18 changes: 18 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ resource "aws_s3_bucket" "this" {
owner = access_control_translation.value.owner
}
}

dynamic "replication_time" {
for_each = length(keys(lookup(destination.value, "replication_time", {}))) == 0 ? [] : [lookup(destination.value, "replication_time", {})]

content {
status = replication_time.value.status
minutes = replication_time.value.minutes
}
}

dynamic "metrics" {
for_each = length(keys(lookup(destination.value, "metrics", {}))) == 0 ? [] : [lookup(destination.value, "metrics", {})]

content {
status = metrics.value.status
minutes = metrics.value.minutes
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.50"
aws = ">= 3.64"
}
}
2 changes: 1 addition & 1 deletion wrappers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inputs = {
}
```

## Usage with Terraform:
## Usage with Terraform

```hcl
module "wrapper" {
Expand Down
2 changes: 2 additions & 0 deletions wrappers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ module "wrapper" {
block_public_policy = lookup(each.value, "block_public_policy", false)
ignore_public_acls = lookup(each.value, "ignore_public_acls", false)
restrict_public_buckets = lookup(each.value, "restrict_public_buckets", false)
control_object_ownership = lookup(each.value, "control_object_ownership", false)
object_ownership = lookup(each.value, "object_ownership", "ObjectWriter")
}
4 changes: 2 additions & 2 deletions wrappers/notification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You may want to use a single Terragrunt configuration file to manage multiple re

This wrapper does not implement any extra functionality.

# Usage with Terragrunt
## Usage with Terragrunt

`terragrunt.hcl`:

Expand All @@ -28,7 +28,7 @@ inputs = {
}
```

## Usage with Terraform:
## Usage with Terraform

```hcl
module "wrapper" {
Expand Down
4 changes: 2 additions & 2 deletions wrappers/object/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You may want to use a single Terragrunt configuration file to manage multiple re

This wrapper does not implement any extra functionality.

# Usage with Terragrunt
## Usage with Terragrunt

`terragrunt.hcl`:

Expand All @@ -28,7 +28,7 @@ inputs = {
}
```

## Usage with Terraform:
## Usage with Terraform

```hcl
module "wrapper" {
Expand Down

0 comments on commit fa1defc

Please sign in to comment.