diff --git a/.github/workflows/terraform-apply.yml b/.github/workflows/terraform-apply.yml
new file mode 100644
index 00000000000..721d299945e
--- /dev/null
+++ b/.github/workflows/terraform-apply.yml
@@ -0,0 +1,42 @@
+name: Terraform apply
+
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - 'config/clusters/**'
+
+defaults:
+ run:
+ working-directory: config/clusters
+
+env:
+ AWS_REGION: 'eu-west-1'
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+
+jobs:
+ plan:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: hashicorp/setup-terraform@v2
+
+ - name: Terraform fmt
+ id: fmt
+ run: terraform fmt -check
+ continue-on-error: true
+
+ - name: Terraform Init
+ id: init
+ run: terraform init
+
+ - name: Terraform Validate
+ id: validate
+ run: terraform validate -no-color
+
+ - name: Terraform Apply
+ id: apply
+ run: terraform apply -auto-approve
+
diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml
new file mode 100644
index 00000000000..694f57ce10b
--- /dev/null
+++ b/.github/workflows/terraform-plan.yml
@@ -0,0 +1,115 @@
+name: Terraform plan
+
+on:
+ pull_request:
+ branches:
+ - master
+ paths:
+ - 'config/clusters/**'
+
+defaults:
+ run:
+ working-directory: config/clusters
+
+permissions:
+ pull-requests: write
+
+env:
+ AWS_REGION: 'eu-west-1'
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+
+jobs:
+ plan:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: hashicorp/setup-terraform@v2
+
+ - name: Terraform fmt
+ id: fmt
+ run: terraform fmt -check
+ continue-on-error: true
+
+ - name: Terraform Init
+ id: init
+ run: terraform init
+
+ - name: Terraform Validate
+ id: validate
+ run: terraform validate -no-color
+
+ - name: Run Terrascan
+ id: terrascan
+ uses: tenable/terrascan-action@v1.4.1
+ with:
+ iac_type: terraform
+ iac_version: v14
+ policy_type: aws
+ only_warn: true
+
+ - name: Terraform Plan
+ id: plan
+ run: terraform plan -no-color
+ continue-on-error: true
+
+ - name: Update PR
+ id: plan-comment
+ uses: actions/github-script@v6
+ if: github.event_name == 'pull_request'
+ env:
+ PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ // 1. Retrieve existing bot comments for the PR
+ const { data: comments } = await github.rest.issues.listComments({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ })
+ const botComment = comments.find(comment => {
+ return comment.user.type === 'Bot' && comment.body.includes('Terraform Format and Style')
+ })
+
+ // 2. Prepare format of the comment
+ const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
+ #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
+ #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
+ Validation Output
+
+ \`\`\`\n
+ ${{ steps.validate.outputs.stdout }}
+ \`\`\`
+
+
+
+ #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
+
+ Show Plan
+
+ \`\`\`\n
+ ${process.env.PLAN}
+ \`\`\`
+
+
+
+ *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;
+
+ // 3. If we have a comment, update it, otherwise create a new one
+ if (botComment) {
+ github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: botComment.id,
+ body: output
+ })
+ } else {
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: output
+ })
+ }
+