Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions example/s3/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions example/s3/dev.auto.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
environment_name = "dev"
13 changes: 6 additions & 7 deletions example/s3/main.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
module "s3" {
source = "../../../../modules/v2.3.4/modules//s3"
source = "../../module/s3"

## Local Variable ##
bucket_name = "<bucket_name>-${var.environment_name}"
bucket_name = "brunolabs-module-s3-${var.environment_name}"

## Tags##
tags = var.tags
#tags = var.tags
default_tags = {

bu = ""
team = ""
vertical = ""
bu = "test"
team = "dev"
vertical = "vertical-test"

}

}
8 changes: 8 additions & 0 deletions example/s3/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": 4,
"terraform_version": "1.2.5",
"serial": 12,
"lineage": "f50efb2d-bdd9-a01d-c549-03ff0e1a5445",
"outputs": {},
"resources": []
}
225 changes: 225 additions & 0 deletions example/s3/terraform.tfstate.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{
"version": 4,
"terraform_version": "1.2.5",
"serial": 6,
"lineage": "f50efb2d-bdd9-a01d-c549-03ff0e1a5445",
"outputs": {
"arn": {
"value": "arn:aws:s3:::brunolabs-module-s3-dev",
"type": "string"
},
"domain_name": {
"value": "brunolabs-module-s3-dev.s3.amazonaws.com",
"type": "string"
},
"id": {
"value": "brunolabs-module-s3-dev",
"type": "string"
},
"region": {
"value": "us-east-1",
"type": "string"
}
},
"resources": [
{
"module": "module.s3",
"mode": "managed",
"type": "aws_s3_bucket",
"name": "s3_bucket",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"acceleration_status": "",
"acl": null,
"arn": "arn:aws:s3:::brunolabs-module-s3-dev",
"bucket": "brunolabs-module-s3-dev",
"bucket_domain_name": "brunolabs-module-s3-dev.s3.amazonaws.com",
"bucket_prefix": null,
"bucket_regional_domain_name": "brunolabs-module-s3-dev.s3.amazonaws.com",
"cors_rule": [],
"force_destroy": false,
"grant": [
{
"id": "434d22d7cd6ceaa68fed219fd95384068a3d87f378278bbd4017d88a7197f093",
"permissions": [
"FULL_CONTROL"
],
"type": "CanonicalUser",
"uri": ""
}
],
"hosted_zone_id": "Z3AQBSTGFYJSTF",
"id": "brunolabs-module-s3-dev",
"lifecycle_rule": [],
"logging": [],
"object_lock_configuration": [],
"object_lock_enabled": false,
"policy": "",
"region": "us-east-1",
"replication_configuration": [],
"request_payer": "BucketOwner",
"server_side_encryption_configuration": [],
"tags": {
"bu": "bu-test",
"team": "dev",
"vertical": "vertical-test"
},
"tags_all": {
"bu": "bu-test",
"team": "dev",
"vertical": "vertical-test"
},
"versioning": [
{
"enabled": false,
"mfa_delete": false
}
],
"website": [],
"website_domain": null,
"website_endpoint": null
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"module": "module.s3",
"mode": "managed",
"type": "aws_s3_bucket_acl",
"name": "s3_acl",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"access_control_policy": [
{
"grant": [
{
"grantee": [
{
"display_name": "brunopdossantos1993",
"email_address": "",
"id": "434d22d7cd6ceaa68fed219fd95384068a3d87f378278bbd4017d88a7197f093",
"type": "CanonicalUser",
"uri": ""
}
],
"permission": "FULL_CONTROL"
}
],
"owner": [
{
"display_name": "brunopdossantos1993",
"id": "434d22d7cd6ceaa68fed219fd95384068a3d87f378278bbd4017d88a7197f093"
}
]
}
],
"acl": "private",
"bucket": "brunolabs-module-s3-dev",
"expected_bucket_owner": "",
"id": "brunolabs-module-s3-dev,private"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"module.s3.aws_s3_bucket.s3_bucket"
]
}
]
},
{
"module": "module.s3",
"mode": "managed",
"type": "aws_s3_bucket_public_access_block",
"name": "s3_block_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"block_public_acls": true,
"block_public_policy": true,
"bucket": "brunolabs-module-s3-dev",
"id": "brunolabs-module-s3-dev",
"ignore_public_acls": true,
"restrict_public_buckets": true
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"module.s3.aws_s3_bucket.s3_bucket"
]
}
]
},
{
"module": "module.s3",
"mode": "managed",
"type": "aws_s3_bucket_server_side_encryption_configuration",
"name": "s3_sse",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"bucket": "brunolabs-module-s3-dev",
"expected_bucket_owner": "",
"id": "brunolabs-module-s3-dev",
"rule": [
{
"apply_server_side_encryption_by_default": [
{
"kms_master_key_id": "",
"sse_algorithm": "AES256"
}
],
"bucket_key_enabled": null
}
]
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"module.s3.aws_s3_bucket.s3_bucket"
]
}
]
},
{
"module": "module.s3",
"mode": "managed",
"type": "aws_s3_bucket_versioning",
"name": "s3_versioning",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"bucket": "brunolabs-module-s3-dev",
"expected_bucket_owner": "",
"id": "brunolabs-module-s3-dev",
"mfa": null,
"versioning_configuration": [
{
"mfa_delete": "",
"status": "Enabled"
}
]
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"module.s3.aws_s3_bucket.s3_bucket"
]
}
]
}
]
}
Binary file added example/s3/tfplan
Binary file not shown.
4 changes: 2 additions & 2 deletions example/s3/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "environment_name" {
description = "Required: Name of environment"
}

variable "tags" {
/*variable "tags" {
description = "Tags of S3 Bucket"
type = map(any)
}
}*/
10 changes: 10 additions & 0 deletions example/s3/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = "~> 1.2.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.23.0"
}
}
}
3 changes: 0 additions & 3 deletions module/s3/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#tfsec:ignore:aws-s3-enable-versioning
#tfsec:ignore:aws-s3-enable-bucket-logging
#tfsec:ignore:aws-s3-enable-bucket-encryption
resource "aws_s3_bucket" "s3_bucket" {
bucket = var.bucket_name
tags = merge(var.tags, var.default_tags, var.s3_tags)
Expand Down