End-to-end tests for terraform modules (#1751)

Add end-to-end tests (apply, plan, destroy) for examples.

When run, `tests/examples_e2e`:
1. Create an environment for tests to run (folder, project vpc network) 
2. For each marked example (with `e2e` tftest directive), run apply, plan, destroy
3. Verify:
* no failure in apply
* empty plan after apply
* no failure during destroy
4. When all tests are done, destroy test environment

More details in `tests/examples_e2e/README.md`
This commit is contained in:
Wiktor Niesiobędzki
2023-10-20 09:59:52 +02:00
committed by GitHub
parent 4e439720aa
commit d07daf966a
16 changed files with 619 additions and 30 deletions

View File

@@ -28,7 +28,7 @@ IAM bindings support the usual syntax. Container environment values can be decla
```hcl
module "cloud_run" {
source = "./fabric/modules/cloud-run"
project_id = "my-project"
project_id = var.project_id
name = "hello"
containers = {
hello = {
@@ -49,7 +49,7 @@ module "cloud_run" {
"roles/run.invoker" = ["allUsers"]
}
}
# tftest modules=1 resources=2 inventory=simple.yaml
# tftest modules=1 resources=2 inventory=simple.yaml e2e
```
### Mounting secrets as volumes