From 42c356d2a1d359f64261b09eae2965be675f2d7e Mon Sep 17 00:00:00 2001 From: Ajay Kumar Dhyani Date: Wed, 21 Oct 2020 20:03:01 +0530 Subject: [PATCH] add terraform pipeline --- .github/workflows/terraform.yml | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/terraform.yml diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 0000000..8066742 --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,72 @@ +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 basic-s3_example' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'init' + tf_actions_working_dir: ./_example/basic-s3_function + + - name: 'Terraform validate basic-s3_example' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'validate' + tf_actions_working_dir: ./_example/basic-s3_function + + - name: 'Terraform init basic_function' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'init' + tf_actions_working_dir: ./_example/basic_function + + - name: 'Terraform validate basic_function' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'validate' + tf_actions_working_dir: ./_example/basic_function + + - name: 'Terraform init complete_example' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'init' + tf_actions_working_dir: ./_example/complete_function + + - name: 'Terraform validate complete_example' + uses: 'clouddrove/github-actions@v4.0' + with: + actions_subcommand: 'validate' + tf_actions_working_dir: ./_example/complete_function + + - 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