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