From 761fae5d7ccf85ecca272d91e059223419955bd9 Mon Sep 17 00:00:00 2001 From: nileshgadgi Date: Fri, 28 Jul 2023 14:40:09 +0530 Subject: [PATCH] feat: Update pipelines and readme.md --- .github/workflows/auto_assignee.yml | 14 +++++ .github/workflows/readme.yml | 16 +++--- .github/workflows/terraform.yml | 84 ----------------------------- .github/workflows/terratest.yml | 44 --------------- .github/workflows/tf-checks.yml | 11 ++++ .github/workflows/tflint.yml | 11 ++++ README.md | 24 +++++---- README.yaml | 16 ++++-- _test/ses_test.go | 32 ----------- 9 files changed, 70 insertions(+), 182 deletions(-) create mode 100644 .github/workflows/auto_assignee.yml delete mode 100644 .github/workflows/terraform.yml delete mode 100644 .github/workflows/terratest.yml create mode 100644 .github/workflows/tf-checks.yml create mode 100644 .github/workflows/tflint.yml delete mode 100644 _test/ses_test.go diff --git a/.github/workflows/auto_assignee.yml b/.github/workflows/auto_assignee.yml new file mode 100644 index 0000000..77d5fdf --- /dev/null +++ b/.github/workflows/auto_assignee.yml @@ -0,0 +1,14 @@ +name: Auto Assign PRs + +on: + pull_request: + types: [opened, reopened] + + workflow_dispatch: +jobs: + assignee: + uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master + secrets: + GITHUB: ${{ secrets.GITHUB }} + with: + assignees: 'clouddrove-ci' \ No newline at end of file diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 54f849a..02041f3 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -5,15 +5,15 @@ on: - master jobs: - readme-create: + readme: name: 'readme-create' runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@master - name: 'Set up Python 3.7' - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.x' @@ -21,17 +21,17 @@ jobs: uses: 'clouddrove/github-actions@v9.0.2' with: actions_subcommand: 'readme' - github_token: '${{ secrets.GITHUB}}' + github_token: '${{ secrets.GITHUB }}' env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 'pre-commit check errors' - uses: pre-commit/action@v2.0.0 + uses: pre-commit/action@v3.0.0 continue-on-error: true - name: 'pre-commit fix errors' - uses: pre-commit/action@v2.0.0 + uses: pre-commit/action@v3.0.0 continue-on-error: true - name: 'push readme' @@ -40,7 +40,7 @@ jobs: with: actions_subcommand: 'push' env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 'Slack Notification' uses: clouddrove/action-slack@v2 diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml deleted file mode 100644 index 9d540ca..0000000 --- a/.github/workflows/terraform.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: static-checks - -on: - pull_request: - -jobs: - versionExtract: - name: Get min/max versions - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Terraform min/max versions - id: minMax - uses: clowdhaus/terraform-min-max@main - outputs: - minVersion: ${{ steps.minMax.outputs.minVersion }} - maxVersion: ${{ steps.minMax.outputs.maxVersion }} - - - versionEvaluate: - name: Evaluate Terraform versions - runs-on: ubuntu-latest - needs: versionExtract - strategy: - fail-fast: false - matrix: - version: - - ${{ needs.versionExtract.outputs.minVersion }} - - ${{ needs.versionExtract.outputs.maxVersion }} - directory: - - _example/ - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Terraform v${{ matrix.version }} - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: ${{ matrix.version }} - - - name: 'Configure AWS Credentials' - uses: clouddrove/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} - aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} - aws-region: us-east-2 - - - name: Init & validate v${{ matrix.version }} - run: | - cd ${{ matrix.directory }} - terraform init - terraform validate - - - - name: tflint - uses: reviewdog/action-tflint@master - with: - tflint_version: v0.29.0 - github_token: ${{ secrets.GITHUB }} - working_directory: ${{ matrix.directory }} - fail_on_error: 'true' - filter_mode: 'nofilter' - flags: '--module' - - format: - name: Check code format - runs-on: ubuntu-latest - needs: versionExtract - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }} - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: ${{ needs.versionExtract.outputs.maxVersion }} - - - name: Check Terraform format changes - run: terraform fmt --recursive \ No newline at end of file diff --git a/.github/workflows/terratest.yml b/.github/workflows/terratest.yml deleted file mode 100644 index ede636a..0000000 --- a/.github/workflows/terratest.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: 'Terratest GitHub Actions' -on: - pull_request: - branches: - - master - types: [labeled] - -jobs: - terraform: - name: 'Terraform' - runs-on: ubuntu-latest - steps: - - - name: 'Checkout' - uses: actions/checkout@master - - - name: Configure AWS Credentials - uses: clouddrove/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} - aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} - aws-region: us-east-2 - - - - name: 'Terratest' - if: ${{ github.event.label.name == 'terratest' }} - uses: 'clouddrove/github-actions@v9.0.2' - with: - actions_subcommand: 'terratest' - tf_actions_working_dir: '_test' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - - name: 'Slack Notification' - uses: clouddrove/action-slack@v2 - with: - status: ${{ job.status }} - fields: repo,author - author_name: 'CloudDrove' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required - if: always() diff --git a/.github/workflows/tf-checks.yml b/.github/workflows/tf-checks.yml new file mode 100644 index 0000000..7a29be3 --- /dev/null +++ b/.github/workflows/tf-checks.yml @@ -0,0 +1,11 @@ +name: tf-checks +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +jobs: + complete: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master + with: + working_directory: './_example/' \ No newline at end of file diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml new file mode 100644 index 0000000..d1b5a64 --- /dev/null +++ b/.github/workflows/tflint.yml @@ -0,0 +1,11 @@ +name: tf-lint +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +jobs: + tflint: + uses: clouddrove/test-tfsec/.github/workflows/tflint.yaml@master + secrets: + GITHUB: ${{ secrets.GITHUB }} \ No newline at end of file diff --git a/README.md b/README.md index 67af2d9..ec457af 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,20 @@ This module has a few dependencies: ### Simple Example Here is an example of how you can use this module in your inventory structure: ```hcl -module "ses" { - source = "clouddrove/ses/aws" - version = "1.3.0" - domain = "clouddrove.com" - iam_name = "ses-user" - zone_id = "DSSCTGRTHD" - enable_verification = true - enable_mx = false - enable_spf_domain = false - } + module "ses" { + source = "clouddrove/ses/aws" + version = "1.3.0" + + domain = "clouddrove.com" + enable_email = true + emails = ["random@gmail.com"] + iam_name = "ses-user1" + + zone_id = "DSSCTGRTHD" + enable_verification = false + enable_mx = false + enable_spf_domain = false + } ``` diff --git a/README.yaml b/README.yaml index c5d3095..ff89e63 100644 --- a/README.yaml +++ b/README.yaml @@ -28,6 +28,10 @@ badges: image: "https://github.com/clouddrove/terraform-aws-ses/actions/workflows/terraform.yml/badge.svg" url: "https://github.com/clouddrove/terraform-aws-ses/actions/workflows/terraform.yml" +prerequesties: + - name: Terraform 1.4.6 + url: https://learn.hashicorp.com/terraform/getting-started/install.html + # description of this project description: |- Terraform module to create an SES Identity with SES IAM user on AWS. @@ -44,11 +48,15 @@ usage : |- module "ses" { source = "clouddrove/ses/aws" version = "1.3.0" - domain = "clouddrove.com" - iam_name = "ses-user" + + domain = "clouddrove.com" + enable_email = true + emails = ["random@gmail.com"] + iam_name = "ses-user1" + zone_id = "DSSCTGRTHD" - enable_verification = true + enable_verification = false enable_mx = false enable_spf_domain = false - } + } ``` diff --git a/_test/ses_test.go b/_test/ses_test.go deleted file mode 100644 index f3a03a9..0000000 --- a/_test/ses_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Managed By : CloudDrove -// Description : This Terratest is used to test the Terraform SES module. -// Copyright @ CloudDrove. All Right Reserved. -package test - -import ( - "testing" - "github.com/stretchr/testify/assert" - "github.com/gruntwork-io/terratest/modules/terraform" -) - -func Test(t *testing.T) { - t.Parallel() - - terraformOptions := &terraform.Options{ - // Source path of Terraform directory. - TerraformDir: "../_example", - Upgrade: true, - } - - // This will run 'terraform init' and 'terraform application' and will fail the test if any errors occur - terraform.InitAndApply(t, terraformOptions) - - // To clean up any resources that have been created, run 'terraform destroy' towards the end of the test - defer terraform.Destroy(t, terraformOptions) - - // To get the value of an output variable, run 'terraform output' - Arn := terraform.Output(t, terraformOptions, "domain_identity_arn") - - // Check that we get back the outputs that we expect - assert.Contains(t, Arn, "arn:aws:ses") -}