Allow per-module terraform fixtures (#1914)

* Allow terraform fixtures for examples

* Allow defining multiple fixtures, and named fixtures under tests/fixtures/

* Enable e2e for wiktorn

* Fix prepare_files call for e2e

* Move fixture to separate file, fix test

* Revert shallow-copying symlinks, performane penalty - 20%

* Update tfdoc.py to list used fixtures

---------

Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
This commit is contained in:
Julio Castillo
2023-12-29 10:43:44 +01:00
committed by GitHub
parent 2ad109ae23
commit fde7b76036
7 changed files with 145 additions and 29 deletions

View File

@@ -31,6 +31,7 @@ Due to the complexity of the underlying resources, changes to the configuration
- [Files](#files)
- [Variables](#variables)
- [Outputs](#outputs)
- [Fixtures](#fixtures)
<!-- END TOC -->
### Minimal HTTP Example
@@ -40,18 +41,18 @@ An HTTP load balancer with a backend service pointing to a GCE instance group:
```hcl
module "glb-0" {
source = "./fabric/modules/net-lb-app-ext"
project_id = "myprj"
project_id = var.project_id
name = "glb-test-0"
backend_service_configs = {
default = {
backends = [
{ backend = "projects/myprj/zones/europe-west8-b/instanceGroups/myig-b" },
{ backend = "projects/myprj/zones/europe-west8-c/instanceGroups/myig-c" },
{ backend = module.compute-mig-a.group.id },
{ backend = module.compute-mig-b.group.id },
]
}
}
}
# tftest modules=1 resources=5
# tftest modules=3 resources=9 fixtures=fixtures/compute-mig-ab.tf e2e
```
### Minimal HTTPS examples
@@ -895,4 +896,8 @@ module "glb-0" {
| [neg_ids](outputs.tf#L67) | Autogenerated network endpoint group ids. | |
| [psc_neg_ids](outputs.tf#L74) | Autogenerated PSC network endpoint group ids. | |
| [serverless_neg_ids](outputs.tf#L81) | Autogenerated serverless network endpoint group ids. | |
## Fixtures
- [compute-mig-ab.tf](../../tests/fixtures/compute-mig-ab.tf)
<!-- END TFDOC -->