Skip to content

Commit

Permalink
Auto Format
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudpossebot committed Feb 10, 2022
1 parent 1c615f0 commit 59b69f2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ Available targets:
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.68.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.7 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.68.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0.0 |
| <a name="provider_time"></a> [time](#provider\_time) | >= 0.7 |

## Modules
Expand All @@ -238,9 +238,18 @@ Available targets:
| [aws_iam_role.replication](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.replication](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_s3_bucket.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_accelerate_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_accelerate_configuration) | resource |
| [aws_s3_bucket_acl.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl) | resource |
| [aws_s3_bucket_cors_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_cors_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.bucket-config](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_logging.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_logging) | resource |
| [aws_s3_bucket_ownership_controls.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_ownership_controls) | resource |
| [aws_s3_bucket_policy.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_replication_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_replication_configuration) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_versioning.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource |
| [aws_s3_bucket_website_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_website_configuration) | resource |
| [time_sleep.wait_for_aws_s3_bucket_settings](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [aws_iam_policy_document.aggregated_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand Down
13 changes: 11 additions & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.68.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0.0 |
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.7 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.68.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0.0 |
| <a name="provider_time"></a> [time](#provider\_time) | >= 0.7 |

## Modules
Expand All @@ -29,9 +29,18 @@
| [aws_iam_role.replication](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.replication](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_s3_bucket.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_accelerate_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_accelerate_configuration) | resource |
| [aws_s3_bucket_acl.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl) | resource |
| [aws_s3_bucket_cors_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_cors_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.bucket-config](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_logging.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_logging) | resource |
| [aws_s3_bucket_ownership_controls.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_ownership_controls) | resource |
| [aws_s3_bucket_policy.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_replication_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_replication_configuration) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_versioning.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource |
| [aws_s3_bucket_website_configuration.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_website_configuration) | resource |
| [time_sleep.wait_for_aws_s3_bucket_settings](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [aws_iam_policy_document.aggregated_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand Down
30 changes: 15 additions & 15 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ resource "aws_s3_bucket" "default" {
#bridgecrew:skip=BC_AWS_S3_16:Skipping `Ensure S3 bucket versioning is enabled` because dynamic blocks are not supported by checkov
#bridgecrew:skip=BC_AWS_S3_14:Skipping `Ensure all data stored in the S3 bucket is securely encrypted at rest` because variables are not understood
#bridgecrew:skip=BC_AWS_GENERAL_56:Skipping `Ensure that S3 buckets are encrypted with KMS by default` because we do not have good defaults
count = local.enabled ? 1 : 0
bucket = local.bucket_name
force_destroy = var.force_destroy
tags = module.this.tags
count = local.enabled ? 1 : 0
bucket = local.bucket_name
force_destroy = var.force_destroy
tags = module.this.tags

dynamic "object_lock_configuration" {
for_each = var.object_lock_configuration != null ? [1] : []
Expand All @@ -39,15 +39,15 @@ resource "aws_s3_bucket" "default" {
}

resource "aws_s3_bucket_logging" "default" {
count = local.enabled && var.logging != null ? 1 : 0
count = local.enabled && var.logging != null ? 1 : 0
bucket = join("", aws_s3_bucket.default.*.id)

target_bucket = var.logging["bucket_name"]
target_prefix = var.logging["prefix"]
}

resource "aws_s3_bucket_website_configuration" "default" {
count = local.enabled && var.website_inputs != null ? 1 : 0
count = local.enabled && var.website_inputs != null ? 1 : 0
bucket = join("", aws_s3_bucket.default.*.id)

index_document {
Expand Down Expand Up @@ -87,7 +87,7 @@ resource "aws_s3_bucket_website_configuration" "default" {
}

resource "aws_s3_bucket_acl" "default" {
count = local.enabled ? 1 : 0
count = local.enabled ? 1 : 0
bucket = join("", aws_s3_bucket.default.*.id)

acl = try(length(var.grants), 0) == 0 ? var.acl : null
Expand All @@ -98,9 +98,9 @@ resource "aws_s3_bucket_acl" "default" {

content {
grantee {
id = grant.value.id
type = grant.value.type
uri = grant.value.uri
id = grant.value.id
type = grant.value.type
uri = grant.value.uri
}
permissions = grant.value.permissions
}
Expand All @@ -111,7 +111,7 @@ resource "aws_s3_bucket_acl" "default" {
# https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html
# https://www.terraform.io/docs/providers/aws/r/s3_bucket.html#enable-default-server-side-encryption
resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
count = local.enabled ? 1 : 0
count = local.enabled ? 1 : 0
bucket = join("", aws_s3_bucket.default.*.id)

rule {
Expand Down Expand Up @@ -143,7 +143,7 @@ resource "aws_s3_bucket_cors_configuration" "default" {
}

resource "aws_s3_bucket_lifecycle_configuration" "bucket-config" {
count = local.enabled && length(var.lifecycle_rules) > 0 ? 1 : 0
count = local.enabled && length(var.lifecycle_rules) > 0 ? 1 : 0
bucket = join("", aws_s3_bucket.default.*.id)

dynamic "rule" {
Expand Down Expand Up @@ -221,14 +221,14 @@ resource "aws_s3_bucket_lifecycle_configuration" "bucket-config" {
}

resource "aws_s3_bucket_accelerate_configuration" "default" {
count = local.transfer_acceleration_enabled ? 1 : 0
count = local.transfer_acceleration_enabled ? 1 : 0
bucket = join("", aws_s3_bucket.default.*.id)
status = "Enabled"
}

resource "aws_s3_bucket_versioning" "default" {
count = local.versioning_enabled ? 1 : 0

bucket = join("", aws_s3_bucket.default.*.id)

versioning_configuration {
Expand All @@ -240,7 +240,7 @@ resource "aws_s3_bucket_replication_configuration" "default" {
count = local.replication_enabled ? 1 : 0

bucket = join("", aws_s3_bucket.default.*.id)
role = aws_iam_role.replication[0].arn
role = aws_iam_role.replication[0].arn

dynamic "rule" {
for_each = local.s3_replication_rules == null ? [] : local.s3_replication_rules
Expand Down

0 comments on commit 59b69f2

Please sign in to comment.