From ce01445782cd0b9b7326680a9fa26e9617e7362f Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dhyani Date: Tue, 27 Oct 2020 20:14:01 +0530 Subject: [PATCH 1/3] upgrade terraform version to 0.13.0 and add pipelines --- .pre-commit-config.yaml | 6 +++--- LICENSE | 2 +- README.yaml | 5 +++-- main.tf | 3 ++- versions.tf | 7 ++++++- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa6e42c..9a789cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: git://github.com/antonbabenko/pre-commit-terraform - rev: v1.12.0 + rev: v1.43.0 hooks: - id: terraform_fmt - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.0.0 + rev: v3.2.0 hooks: - id: check-merge-conflict - - id: trailing-whitespace - id: check-yaml - id: check-added-large-files + - id: trailing-whitespace \ No newline at end of file diff --git a/LICENSE b/LICENSE index 136d77d..807110a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Cloud Drove +Copyright (c) 2020 Cloud Drove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.yaml b/README.yaml index db8c711..eac6978 100644 --- a/README.yaml +++ b/README.yaml @@ -16,7 +16,7 @@ github_repo: clouddrove/terraform-aws-cloudtrail-slack-notification # Badges to display badges: - name: "Terraform" - image: "https://img.shields.io/badge/Terraform-v0.12-green" + image: "https://img.shields.io/badge/Terraform-v0.13-green" url: "https://www.terraform.io" - name: "Licence" image: "https://img.shields.io/badge/License-MIT-blue.svg" @@ -36,7 +36,8 @@ usage : |- Here is an example of how you can use this module in your inventory structure: ```hcl module "cloudtrail-slack-notification" { - source = "git::https://github.com/clouddrove/terraform-aws-cloudtrail-slack-notification.git?ref=tags/0.12.2" + source = "clouddrove/cloudtrail-slack-notification/aws" + version = "0.13.0" name = "cloudtrail-slack-notification" application = "clouddrove" environment = "test" diff --git a/main.tf b/main.tf index 677be6e..1ed5bdd 100644 --- a/main.tf +++ b/main.tf @@ -12,7 +12,8 @@ resource "null_resource" "main" { #Module : Cloudtrail Logs #Description : This terraform module is designed to create cloudtrail log. module "cloudtrail-slack" { - source = "git::https://github.com/clouddrove/terraform-aws-lambda.git?ref=tags/0.12.5" + source = "clouddrove/lambda/aws" + version = "0.13.0" name = var.name application = var.application diff --git a/versions.tf b/versions.tf index ea541ea..ae70918 100644 --- a/versions.tf +++ b/versions.tf @@ -1,4 +1,9 @@ # Terraform version terraform { - required_version = ">= 0.12" + required_version = ">= 0.13" + required_providers { + aws = { + source = "hashicorp/aws" + } + } } \ No newline at end of file From 4d86e06e74e0ff756bbe74f3616e54b2ca2db31f Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dhyani Date: Tue, 27 Oct 2020 20:19:02 +0530 Subject: [PATCH 2/3] upgrade terraform version to 0.13.0 and add pipelines --- .github/workflows/readme.yml | 54 ++++++++++++++++++++++++++++++++ .github/workflows/terraform.yml | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/workflows/readme.yml create mode 100644 .github/workflows/terraform.yml diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml new file mode 100644 index 0000000..3646f9f --- /dev/null +++ b/.github/workflows/readme.yml @@ -0,0 +1,54 @@ +name: 'Create README.md file' +on: + push: + branches: + - master + +jobs: + readme-create: + name: 'readme-create' + runs-on: ubuntu-latest + steps: + - name: 'Checkout' + uses: actions/checkout@master + + - name: Set up Python 3.7. + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: 'create readme' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'readme' + github_token: '${{ secrets.GITHUB}}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} + + + - name: pre-commit check errors + uses: pre-commit/action@v2.0.0 + continue-on-error: true + + - name: pre-commit fix erros + uses: pre-commit/action@v2.0.0 + continue-on-error: true + + - name: 'push readme' + uses: 'clouddrove/github-actions@v4.0' + continue-on-error: true + with: + actions_subcommand: 'push' + 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() \ No newline at end of file diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 0000000..372b0fb --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,55 @@ +name: 'Terraform GitHub Actions' +on: + pull_request: + branches: + - master + +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: 'Terraform Format' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'fmt' + + - name: 'Terraform init' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'init' + tf_actions_working_dir: ./_example + + - name: 'Terraform validate' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'validate' + tf_actions_working_dir: ./_example + + - name: 'Terraform plan' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'plan' + tf_actions_working_dir: ./_example + + - 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() \ No newline at end of file From f68d9c2e8148d27fc2dbb7525970bd1251d8c6c9 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dhyani Date: Tue, 27 Oct 2020 20:21:15 +0530 Subject: [PATCH 3/3] upgrade terraform version to 0.13.0 and add pipelines --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 1ed5bdd..e66e1d5 100644 --- a/main.tf +++ b/main.tf @@ -3,7 +3,7 @@ resource "null_resource" "main" { - count = var.enabled ? 1 : 0 + count = var.enabled ? 1 : 0 provisioner "local-exec" { command = format("cd %s/slack && bash build.sh", path.module) } @@ -12,8 +12,8 @@ resource "null_resource" "main" { #Module : Cloudtrail Logs #Description : This terraform module is designed to create cloudtrail log. module "cloudtrail-slack" { - source = "clouddrove/lambda/aws" - version = "0.13.0" + source = "clouddrove/lambda/aws" + version = "0.13.0" name = var.name application = var.application