@@ -13,7 +13,9 @@ Uses the [GitLab Terraform Provider](https://registry.terraform.io/providers/git
1313- 🔍 ** Drift Detection** : Scan GitLab groups and projects to identify resources not managed by Terraform
1414- 📝 ** Code Generation** : Automatically generate Terraform code for unmanaged resources
1515- 🔄 ** Diff Comparison** : Show differences between existing and generated Terraform configurations
16- - 🐳 ** Docker-ready** : Designed for CI/CD pipeline
16+ - 📦 ** Import Commands** : Generate ` terraform import ` commands for new resources
17+ - 🔀 ** Merge Request Creation** : Automatically create or update GitLab MRs with generated ` .tf ` files
18+ - 🐳 ** Docker-ready** : Designed for CI/CD pipelines
1719
1820## Quick Start
1921
@@ -35,6 +37,17 @@ drift-check:
3537 - terraform-gitlab-drift scan --group $CI_PROJECT_ROOT_NAMESPACE
3638` ` `
3739
40+ ### Auto-create MR on Drift
41+
42+ ` ` ` yaml
43+ drift-remediation :
44+ image : ghcr.io/xmoelletschi/terraform-gitlab-drift:latest
45+ script :
46+ - terraform-gitlab-drift scan --group $CI_PROJECT_ROOT_NAMESPACE --create-mr --show-diff=false
47+ ` ` `
48+
49+ When drift is detected, this creates (or updates) a merge request in the current repository with the generated ` .tf` files. The target repo is auto-detected from the git remote; use `--target-repo` to override.
50+
3851# # Configuration
3952
4053# ## Command-line Flags
@@ -48,6 +61,9 @@ drift-check:
4861| `--overwrite` | - | `false` | Overwrite files in terraform directory |
4962| `--show-diff` | - | `true` | Show diff between generated and existing files |
5063| `--skip` | - | - | Resource types to skip (comma-separated). Use `premium` to skip all Premium-tier resources |
64+ | `--create-mr` | - | `false` | Create a merge request with generated Terraform code |
65+ | `--target-repo` | - | *(auto-detected)* | GitLab project path or ID for the MR |
66+ | `--mr-dest-path` | - | *(root)* | Path within target repo where `.tf` files go |
5167| `--verbose`, `-v` | - | `false` | Enable verbose (debug) logging |
5268| `--json` | - | `false` | Output logs in JSON format |
5369
0 commit comments