diff --git a/.github/workflows/terraform_workflow.yml b/.github/workflows/terraform_workflow.yml index bca10d5c..5f78e163 100644 --- a/.github/workflows/terraform_workflow.yml +++ b/.github/workflows/terraform_workflow.yml @@ -28,7 +28,7 @@ on: required: false type: boolean default: false - description: 'Set true to to destroy terraform infrastructure.' + description: 'Set true to destroy terraform infrastructure.' approvers: required: false type: string @@ -36,7 +36,7 @@ on: terraform_version: type: string default: 1.3.6 - description: 'Required erraform version ' + description: 'Required Terraform version' timeout: required: false type: number @@ -76,6 +76,11 @@ on: required: false type: string default: "" + plan_only: + description: "Set this to `true` to run `terraform plan` only" + required: false + type: boolean + default: false secrets: AZURE_CREDENTIALS: required: false @@ -239,6 +244,7 @@ jobs: echo "${delimiter}" >> $GITHUB_OUTPUT - name: ✅ Accept plan or deny + if: ${{ inputs.plan_only != true }} uses: trstringer/manual-approval@v1 timeout-minutes: ${{ inputs.timeout }} with: @@ -248,7 +254,7 @@ jobs: issue-title: "Terraform Plan for Infrastructure Update" - name: 🚀 terraform apply - if: ${{ inputs.destroy != true }} + if: ${{ inputs.destroy != true && inputs.plan_only != true }} run: | if [ -n "${{ inputs.var_file }}" ]; then cd ${{ inputs.working_directory }} diff --git a/README.md b/README.md index ec444935..ec74c2f1 100644 --- a/README.md +++ b/README.md @@ -58,12 +58,12 @@ Above example is just a simple example to call workflow from github shared workf * [Example for scan and push docker image on Dockerhub](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/03.docker.md#example-for-scan-and-push-docker-image-on-dockerhub) * [Example for scan and push docker image on ECR](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/03.docker.md#example-for-scan-and-push-docker-image-on-ecr) 4. [Auto Assign Assignee Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/04.auto-assignee.md) -5. [Terraform Checks Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/05.terraform-checks.md) - * [Example for terraform checks with azure cloud](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/05.terraform-checks.md#example-for-terraform-checks-with-azure-cloud) - * [Example for terraform checks with aws cloud](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/0.5.terraform-checks.md#example-for-terraform-checks-with-aws-cloud) - * [Example for terraform checks with digitalocean cloud](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/05.terraform-checks.md#example-for-terraform-checks-with-digitalocean-cloud) +5. [Terraform Checks Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/05.tf-checks.md) + * [Example for terraform checks with azure cloud](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/05.tf-checks.md#example-for-terraform-checks-with-azure-cloud) + * [Example for terraform checks with aws cloud](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/0.5.tf-checks.md#example-for-terraform-checks-with-aws-cloud) + * [Example for terraform checks with digitalocean cloud](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/05.tf-checks.md#example-for-terraform-checks-with-digitalocean-cloud) 6. [Terraform Lint Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/06.terraform-lint.md) -7. [Terraform Checks Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/07.terraform-checks.md) +7. [Terraform Checks Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/07.tf-checks.md) 8. [Checkov Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/08.checkov.md) 9. [Terraform Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/09.terraform_workflow.md) 10. [Infracost workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/docs/10.infracost.md) @@ -114,11 +114,11 @@ Above example is just a simple example to call workflow from github shared workf 20. [SST Workflow](./docs/20.sst.md) 21. [Stale PR workflow](./docs/21.stale-pr.md) 22. [Tag Release workflow](./docs/22.tag-release.md) -23. [Terraform Checks Workflow](./docs/23.terraform-checks.md) - * [Example for terraform checks with azure cloud](./docs/23.terraform-checks.md#example-for-terraform-checks-with-azure-cloud) - * [Example for terraform checks with aws cloud](./docs/23.terraform-checks.md#example-for-terraform-checks-with-aws-cloud) - * [Example for terraform checks with digitalocean cloud](./docs/23.terraform-checks.md#example-for-terraform-checks-with-digitalocean-cloud) -24. [Terraform Checks Workflow](./docs/24.terraform-checks.md) +23. [Terraform Checks Workflow](./docs/23.tf-checks.md) + * [Example for terraform checks with azure cloud](./docs/23.tf-checks.md#example-for-terraform-checks-with-azure-cloud) + * [Example for terraform checks with aws cloud](./docs/23.tf-checks.md#example-for-terraform-checks-with-aws-cloud) + * [Example for terraform checks with digitalocean cloud](./docs/23.tf-checks.md#example-for-terraform-checks-with-digitalocean-cloud) +24. [Terraform Checks Workflow](./docs/24.tf-checks.md) 25. [Terraform Lint Workflow](./docs/25.terraform-lint.md) 26. [Terraform Module Tag Release Workflow (Shared)](./docs/25.tf-monorepo-tag-release.md) 27. [Terraform PR Plan Diff workflow](./docs/27.tf-pr-checks.md) diff --git a/docs/23.terraform-checks.md b/docs/23.tf-checks.md similarity index 97% rename from docs/23.terraform-checks.md rename to docs/23.tf-checks.md index 7bcdf458..cb22fd1e 100644 --- a/docs/23.terraform-checks.md +++ b/docs/23.tf-checks.md @@ -18,6 +18,7 @@ jobs: uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master with: working_directory: './_example/complete/' + provider: aws # terraform_version: 0.12.31 // Specify the Terraform version to use. Uncomment and provide your desired version, or leave it as is to use the latest version. secrets: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} diff --git a/docs/27.terraform_workflow.md b/docs/27.terraform_workflow.md index 8421eb56..66229173 100644 --- a/docs/27.terraform_workflow.md +++ b/docs/27.terraform_workflow.md @@ -19,12 +19,13 @@ jobs: uses: clouddrove/github-shared-workflows/.github/workflows/terraform_workflow.yml@master with: provider: # aws - working_directory: # Specify terraform code directory in repo - var_file: # name of tfvar file e.g "variable.tfvar" + working_directory: # Specify terraform code directory in repo, eg. './_example/complete/' + var_file: # name of tfvar file, eg. "variable.tfvar" aws_region: # specify region eg. us-east-2 approvers: # Assignee name for approve apply or destroy step minimum-approvals: # Minimum number of approvals required to progress the workflow, deafault value is 1 terraform_version: # Specify terraform version e.g 1.3.6 + plan_only: # If the value is set to true, the workflow will only show terraform plan destroy: # If the value is set to true, the workflow proceeds to the destroy step. However, the default value is false secrets: AWS_ACCESS_KEY_ID: # Specify AWS Access key ID