Commit 51cf9ee7 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

docs: enable review envs auto-cleanup

closes #41
parent 5f30f847
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -348,6 +348,21 @@ Here are variables supported to configure review environments:
| `TF_REVIEW_APPLY_OPTS`   | Terraform extra [apply options](https://developer.hashicorp.com/terraform/cli/commands/apply) for `review` env | `$TF_APPLY_OPTS` |
| `TF_REVIEW_DESTROY_OPTS` | Terraform extra [destroy options](https://developer.hashicorp.com/terraform/cli/commands/destroy) for `review` env | `$TF_DESTROY_OPTS` |

#### Enabling auto-cleanup

GitLab provides a way to automatically [Stop an environment when a merge request is merged or closed](https://docs.gitlab.com/ee/ci/environments/index.html#stop-an-environment-when-a-merge-request-is-merged-or-closed).

It is not enabled by default in the Terraform template, mainly because it is not easy to undo.

Here is what you should add to your `.gitlab-ci.yml` file to enable it for review environments:

```yaml
# auto cleanup review environments (when MR is merged or closed)
tf-review:
  environment:
    on_stop: tf-destroy-review
```

### Integration environment configuration

The integration environment is the environment associated to your integration branch (`develop` by default).