From 7506c26ddbb87729c1602dd75c788b05c227baae Mon Sep 17 00:00:00 2001 From: ankit kumar Date: Wed, 17 Sep 2025 00:43:51 +0530 Subject: [PATCH 1/3] Added terraform-drifts.md file --- docs/30.terraform-drifts.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/30.terraform-drifts.md diff --git a/docs/30.terraform-drifts.md b/docs/30.terraform-drifts.md new file mode 100644 index 00000000..27ebbdb0 --- /dev/null +++ b/docs/30.terraform-drifts.md @@ -0,0 +1,31 @@ +## [terraform drifts Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/.github/workflows/tfdrifts.yml) + +This workflow automates Terraform configuration drift detection by running terraform init/plan against your live infrastructure and signaling when resources have changed outside of code. The reusable workflow is stored at `.github/workflows/tfdrifts.yml` in the shared repo. + +#### Usage +Terraform drift detection within a GitHub environment typically involves automating the terraform plan command to compare the infrastructure defined in your Terraform configuration files with the actual state of your cloud resources. This process can be integrated into GitHub Actions to provide continuous monitoring and alerting for any discrepancies. + +**Core Concept**: + +- *Terraform Plan*: The terraform plan command is central to drift detection. When executed, it compares the current Terraform state file with the desired configuration in your .tf files and the actual state of your cloud provider resources. If differences are found, it will output the changes that would be applied. + +- *Drift*: Drift occurs when the actual state of your infrastructure diverges from the desired state defined in your Terraform code. This can happen due to manual changes made outside of Terraform, or unexpected actions from services interacting with your cloud resources. + +**Key capabilities**: +- Detect drift via terraform plan. +- Works with AWS, Azure, or GCP (select with provider). + +#### Example +```yaml +name: TF-Drift +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +jobs: + tf-lint: + uses: clouddrove/github-shared-workflows/.github/workflows/tfdrift.yml@master + secrets: + GITHUB: ${{ secrets.GITHUB }} +``` \ No newline at end of file From ea57f95acc10e2c0559e44aedf99b5fb4e2d58e0 Mon Sep 17 00:00:00 2001 From: ankit kumar Date: Fri, 19 Sep 2025 22:35:33 +0530 Subject: [PATCH 2/3] Modified the terraform-drifts.md file --- docs/30.terraform-drifts.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/30.terraform-drifts.md b/docs/30.terraform-drifts.md index 27ebbdb0..52c80336 100644 --- a/docs/30.terraform-drifts.md +++ b/docs/30.terraform-drifts.md @@ -26,6 +26,12 @@ on: jobs: tf-lint: uses: clouddrove/github-shared-workflows/.github/workflows/tfdrift.yml@master + with: + working_directory: #'./_example/complete/' + provider: #aws + aws_region: # AWS region secrets: - GITHUB: ${{ secrets.GITHUB }} + AWS_ACCESS_KEY_ID: # Specify AWS Access key ID + AWS_SECRET_ACCESS_KEY: # Specify AWS Secret Access key ID + AWS_SESSION_TOKEN: # Specify Session ID ``` \ No newline at end of file From ae67d31e8f7b812f1125044c18979f565fcec8b5 Mon Sep 17 00:00:00 2001 From: ankit kumar Date: Fri, 19 Sep 2025 23:33:19 +0530 Subject: [PATCH 3/3] Modified the terraform-drifts.md file --- docs/30.terraform-drifts.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/30.terraform-drifts.md b/docs/30.terraform-drifts.md index 52c80336..4f249487 100644 --- a/docs/30.terraform-drifts.md +++ b/docs/30.terraform-drifts.md @@ -2,15 +2,6 @@ This workflow automates Terraform configuration drift detection by running terraform init/plan against your live infrastructure and signaling when resources have changed outside of code. The reusable workflow is stored at `.github/workflows/tfdrifts.yml` in the shared repo. -#### Usage -Terraform drift detection within a GitHub environment typically involves automating the terraform plan command to compare the infrastructure defined in your Terraform configuration files with the actual state of your cloud resources. This process can be integrated into GitHub Actions to provide continuous monitoring and alerting for any discrepancies. - -**Core Concept**: - -- *Terraform Plan*: The terraform plan command is central to drift detection. When executed, it compares the current Terraform state file with the desired configuration in your .tf files and the actual state of your cloud provider resources. If differences are found, it will output the changes that would be applied. - -- *Drift*: Drift occurs when the actual state of your infrastructure diverges from the desired state defined in your Terraform code. This can happen due to manual changes made outside of Terraform, or unexpected actions from services interacting with your cloud resources. - **Key capabilities**: - Detect drift via terraform plan. - Works with AWS, Azure, or GCP (select with provider).