From f1190a55cb148b8dbd289186db0b00c6f1007cf5 Mon Sep 17 00:00:00 2001 From: Anmol Nagpal Date: Mon, 10 Aug 2020 21:47:24 +0530 Subject: [PATCH 1/3] remove region variable --- README.md | 25 +++++++++-------------- README.yaml | 15 +++++--------- _example/default-s3/example.tf | 2 -- _example/encryption-s3/example.tf | 2 -- _example/logging-encryption-s3/example.tf | 2 -- _example/logging-s3/example.tf | 2 -- _example/website-s3/example.tf | 1 - main.tf | 5 ----- variables.tf | 6 ------ 9 files changed, 15 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 9ed2d52..bc9c144 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Terraform AWS S3 -

+

Terraform module to create default S3 bucket with logging and encryption type specific features.

@@ -38,7 +38,7 @@
-We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy Bigger problems are always solved by breaking them into smaller manageable problems. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller connected yet manageable pieces within the infrastructure. +We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy Bigger problems are always solved by breaking them into smaller manageable problems. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller connected yet manageable pieces within the infrastructure. This module is basically combination of [Terraform open source](https://www.terraform.io/) and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself. @@ -49,7 +49,7 @@ We have [*fifty plus terraform modules*][terraform_modules]. A few of them are c ## Prerequisites -This module has a few dependencies: +This module has a few dependencies: - [Terraform 0.12](https://learn.hashicorp.com/terraform/getting-started/install.html) - [Go](https://golang.org/doc/install) @@ -72,9 +72,8 @@ Here are some examples of how you can use this module in your inventory structur ### Basic Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "secure-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -86,9 +85,8 @@ module "s3_bucket" { ### Encryption Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "encryption-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -101,9 +99,8 @@ module "s3_bucket" { ### Logging-Encryption Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "logging-encryption-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -118,9 +115,8 @@ module "s3_bucket" { ### Logging Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "logging-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -134,9 +130,8 @@ module "s3_bucket" { ### Website Host Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "website-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -224,7 +219,7 @@ data "aws_iam_policy_document" "default" { ## Testing -In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system. +In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system. You need to run the following command in the testing folder: ```hcl @@ -233,7 +228,7 @@ You need to run the following command in the testing folder: -## Feedback +## Feedback If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-aws-s3/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com). If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/terraform-aws-s3)! diff --git a/README.yaml b/README.yaml index b12c32c..19b5c75 100644 --- a/README.yaml +++ b/README.yaml @@ -36,9 +36,8 @@ usage : |- ### Basic Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "secure-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -50,9 +49,8 @@ usage : |- ### Encryption Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "encryption-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -65,9 +63,8 @@ usage : |- ### Logging-Encryption Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "logging-encryption-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -82,9 +79,8 @@ usage : |- ### Logging Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "logging-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] @@ -98,9 +94,8 @@ usage : |- ### Website Host Bucket ```hcl module "s3_bucket" { - source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.5" + source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.7" name = "website-bucket" - region = "eu-west-1" application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] diff --git a/_example/default-s3/example.tf b/_example/default-s3/example.tf index 128722f..c3b9258 100644 --- a/_example/default-s3/example.tf +++ b/_example/default-s3/example.tf @@ -9,8 +9,6 @@ module "s3_bucket" { application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] - - region = "eu-west-1" versioning = true acl = "private" bucket_enabled = true diff --git a/_example/encryption-s3/example.tf b/_example/encryption-s3/example.tf index d46c5f1..1488d18 100644 --- a/_example/encryption-s3/example.tf +++ b/_example/encryption-s3/example.tf @@ -37,8 +37,6 @@ module "s3_bucket" { application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] - - region = "eu-west-1" versioning = true acl = "private" bucket_encryption_enabled = true diff --git a/_example/logging-encryption-s3/example.tf b/_example/logging-encryption-s3/example.tf index 362044c..7a5b31b 100644 --- a/_example/logging-encryption-s3/example.tf +++ b/_example/logging-encryption-s3/example.tf @@ -9,8 +9,6 @@ module "s3_bucket" { application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] - - region = "eu-west-1" versioning = true acl = "private" bucket_logging_encryption_enabled = true diff --git a/_example/logging-s3/example.tf b/_example/logging-s3/example.tf index a0b94ca..9f605b7 100644 --- a/_example/logging-s3/example.tf +++ b/_example/logging-s3/example.tf @@ -9,8 +9,6 @@ module "s3_bucket" { application = "clouddrove" environment = "test" label_order = ["environment", "application", "name"] - - region = "eu-west-1" versioning = true acl = "private" bucket_logging_enabled = true diff --git a/_example/website-s3/example.tf b/_example/website-s3/example.tf index c43cb51..668e8ab 100644 --- a/_example/website-s3/example.tf +++ b/_example/website-s3/example.tf @@ -10,7 +10,6 @@ module "s3_bucket" { environment = "test" label_order = ["environment", "application", "name"] - region = "eu-west-1" versioning = true acl = "private" website_hosting_bucket = true diff --git a/main.tf b/main.tf index fe79696..153acc7 100644 --- a/main.tf +++ b/main.tf @@ -24,7 +24,6 @@ resource "aws_s3_bucket" "s3_default" { bucket = module.labels.id force_destroy = var.force_destroy - region = var.region acl = var.acl versioning { @@ -87,7 +86,6 @@ resource "aws_s3_bucket" "s3_website" { bucket = module.labels.id force_destroy = var.force_destroy - region = var.region acl = var.acl versioning { @@ -155,7 +153,6 @@ resource "aws_s3_bucket" "s3_logging" { bucket = module.labels.id force_destroy = var.force_destroy - region = var.region acl = var.acl versioning { @@ -212,7 +209,6 @@ resource "aws_s3_bucket" "s3_logging_encryption" { bucket = module.labels.id force_destroy = var.force_destroy - region = var.region acl = var.acl versioning { @@ -298,7 +294,6 @@ resource "aws_s3_bucket" "s3_encryption" { bucket = module.labels.id force_destroy = var.force_destroy - region = var.region acl = var.acl versioning { diff --git a/variables.tf b/variables.tf index 0578c0e..1c234c4 100644 --- a/variables.tf +++ b/variables.tf @@ -62,12 +62,6 @@ variable "versioning" { description = "Enable Versioning of S3." } -variable "region" { - type = string - default = "" - description = "Region Where you want to host S3." -} - variable "acl" { type = string default = "" From 060c2384a27b601e1fdc58ac74b2553baf16acd6 Mon Sep 17 00:00:00 2001 From: Anmol Nagpal Date: Tue, 11 Aug 2020 13:26:18 +0530 Subject: [PATCH 2/3] format tf --- _example/default-s3/example.tf | 8 ++++---- _example/encryption-s3/example.tf | 8 ++++---- _example/logging-encryption-s3/example.tf | 8 ++++---- _example/logging-s3/example.tf | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/_example/default-s3/example.tf b/_example/default-s3/example.tf index c3b9258..a4e8f92 100644 --- a/_example/default-s3/example.tf +++ b/_example/default-s3/example.tf @@ -5,10 +5,10 @@ provider "aws" { module "s3_bucket" { source = "./../../" - name = "secure-bucket" - application = "clouddrove" - environment = "test" - label_order = ["environment", "application", "name"] + name = "secure-bucket" + application = "clouddrove" + environment = "test" + label_order = ["environment", "application", "name"] versioning = true acl = "private" bucket_enabled = true diff --git a/_example/encryption-s3/example.tf b/_example/encryption-s3/example.tf index 1488d18..9532abb 100644 --- a/_example/encryption-s3/example.tf +++ b/_example/encryption-s3/example.tf @@ -33,10 +33,10 @@ data "aws_iam_policy_document" "default" { module "s3_bucket" { source = "./../../" - name = "encryption-bucket" - application = "clouddrove" - environment = "test" - label_order = ["environment", "application", "name"] + name = "encryption-bucket" + application = "clouddrove" + environment = "test" + label_order = ["environment", "application", "name"] versioning = true acl = "private" bucket_encryption_enabled = true diff --git a/_example/logging-encryption-s3/example.tf b/_example/logging-encryption-s3/example.tf index 7a5b31b..631ccfb 100644 --- a/_example/logging-encryption-s3/example.tf +++ b/_example/logging-encryption-s3/example.tf @@ -5,10 +5,10 @@ provider "aws" { module "s3_bucket" { source = "./../../" - name = "logging-encryption-bucket" - application = "clouddrove" - environment = "test" - label_order = ["environment", "application", "name"] + name = "logging-encryption-bucket" + application = "clouddrove" + environment = "test" + label_order = ["environment", "application", "name"] versioning = true acl = "private" bucket_logging_encryption_enabled = true diff --git a/_example/logging-s3/example.tf b/_example/logging-s3/example.tf index 9f605b7..3a10ab1 100644 --- a/_example/logging-s3/example.tf +++ b/_example/logging-s3/example.tf @@ -5,10 +5,10 @@ provider "aws" { module "s3_bucket" { source = "./../../" - name = "logging-bucket" - application = "clouddrove" - environment = "test" - label_order = ["environment", "application", "name"] + name = "logging-bucket" + application = "clouddrove" + environment = "test" + label_order = ["environment", "application", "name"] versioning = true acl = "private" bucket_logging_enabled = true From c581855734cbc80047def868087ccde8b19e534a Mon Sep 17 00:00:00 2001 From: Anmol Nagpal Date: Tue, 11 Aug 2020 15:09:31 +0530 Subject: [PATCH 3/3] format tf --- .github/workflows/terraform.yml | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index a67ca90..bc21a5f 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -79,29 +79,29 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: 'Terratest for default-s3' - uses: clouddrove/github-actions@v2.0 - with: - actions_subcommand: 'terratest' - tf_actions_working_dir: ./_test/default-s3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Terratest for encryption-s3' - uses: clouddrove/github-actions@v2.0 - with: - actions_subcommand: 'terratest' - tf_actions_working_dir: ./_test/encryption-s3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Terratest for website-s3' - uses: clouddrove/github-actions@v2.0 - with: - actions_subcommand: 'terratest' - tf_actions_working_dir: ./_test/website-s3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: 'Terratest for default-s3' + # uses: clouddrove/github-actions@v2.0 + # with: + # actions_subcommand: 'terratest' + # tf_actions_working_dir: ./_test/default-s3 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: 'Terratest for encryption-s3' + # uses: clouddrove/github-actions@v2.0 + # with: + # actions_subcommand: 'terratest' + # tf_actions_working_dir: ./_test/encryption-s3 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: 'Terratest for website-s3' + # uses: clouddrove/github-actions@v2.0 + # with: + # actions_subcommand: 'terratest' + # tf_actions_working_dir: ./_test/website-s3 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 'Slack Notification' uses: clouddrove/action-slack@v2