FAST light implementation (#3255)
* data wip * wip data * update org schema, add note on expansion * all schemas, workload notes * Update WORKLOG.md * Update WORKLOG.md * Update WORKLOG.md * Update WORKLOG.md * wip * data wip * wip * wip * wip * wip * org module IAM context (using lookup) * new-style context expansion in project IAM * remove spurious file * project module contexts * finalize context replacement format for project module * revert org module changes * fix tag id interpolation in project * fix tag id interpolation in project * organization module context * organization context test * context expansion for folder tag bindings * test context expansion for tag bindings * service account module context * simplify context local * context for iam service account * nuke blueprints * remove links to blueprints * vpc sc context in project module * Add context to GCS module * Add inline deps to plan_summary script * Make context a top-level variable for folder, organization, sa * Add add context top-level to VPC-SC * move context out of factories_config variable * tfdoc * fix merge * fix merge * fix examples * net-vpc module context * add parent ids to folder context * rename folder parent context * fix folder parent check * new project factory stub * wip * wip * refactor defaults * project iam * bueckts and service accounts * start adding context replacements * better test data * automation resources for folders and projects * automation * add support for project id interpolation * first tested apply * improve IAM description in gcs module * add context to billing account module * add notification channels to billing account module context * add billing budgets to new pf * schemas and defaults * bootstrap wip * bootstrap wip * bootstrap wip * pf outputs * pf fixes * fix pf sample data * bootstrap lite fixes * add locations to organization module contexts * bootstrap lite fixes * org fixes, billing accounts * fix default project parent * bootstrap lite wip * add locations to gcs module context * add context support to logging bucket module * add context to pubsub module * split out iam variables in gcs module * fix logging bucket context test * bootstrap log sink destinations * streamline logging-bucket module variables * fix logging bucket context test * align logging bucket module interface in fast bootstrap * add support for project-level log buckets to project factory * support full context expansion in organization module log sinks * log buckets in fast-lite bootstrap * make og sink type optional in organization module * log sinks in fast-lite bootstrap * set tag values in factory context * bootstrap lite data * output files schema * billing account schema * output files * output providers * gcs output files * boilerplate * tflint * check documentation * check docs * fix project module parent variable validation * fix log bucket examples * allow null parent in project module * silence folder test errors * fix billing account sink example * fix project example * fix billing account module * fix folder tests * fix FAST * fix fast * tfvars outputs * wif * cicd service accounts * cicd * allow defaults in context, minimal org policies * support gcs managed folders in project factory and bootstrap lite * support prefix in provider output files * rename bootstrap stage * gitignore * gitignore * security folder, billing IAM * wip tfvars * fix typo * security IAM * control tag iam/context via variables in organization module * split tag creation from tag IAM to avoid circular refs * port organization module tag changes to project module * implement new-style context expansion in vpc-sc module * fix fast vpc-sc tests * boilerplate * vpc sc stage * schemas * fast-lite compatibility for vpc sc stage * make log project number optional in vpc-sc stage * networking * networking * networking * networking * rename and move new stage under fast * clone pf tests * use context replacement for internal notification channels in billing account module * support service agents in project module iam context replacements * support service agents in project module iam context replacements * add support for kms keys to project module context * experimental pf example test and fixes * fix schemas * fix tests * tfdoc * tfdoc * pf config * experimental pf * remove redundant dot from gcs managed folder IAM keys * bootstrap experimental test * project factory exp stage test * skip tflint for bootstrap experimental test * tflint * fix gcs test * documentation work * documentation work * Update README.md * tfdoc * tfdoc * readme * tfdoc * readme * readme * readme * readme * support universe in pf exp projects * missing universe service agents * org policies import, non-admin billing IAM * todo * fix test * custom constraints * fast classic dataset * fix test data * context replacements in billing module log sinks * fix typo * add support for billing log sinks * update docs * readme * cicd fix and test --------- Co-authored-by: Julio Castillo <jccb@google.com>
This commit is contained in:
committed by
GitHub
parent
dcd762370c
commit
36648b6b63
@@ -18,7 +18,6 @@ Contributors are the engine that keeps Fabric alive so if you were or are planni
|
||||
- [Using external files](#using-external-files)
|
||||
- [Running tests for specific examples](#running-tests-for-specific-examples)
|
||||
- [Generating the inventory automatically](#generating-the-inventory-automatically)
|
||||
- [Building tests for blueprints](#building-tests-for-blueprints)
|
||||
- [Testing via `tfvars` and `yaml` (aka `tftest`-based tests)](#testing-via-tfvars-and-yaml-aka-tftest-based-tests)
|
||||
- [Generating the inventory for `tftest`-based tests](#generating-the-inventory-for-tftest-based-tests)
|
||||
- [Running end-to-end tests](#running-end-to-end-tests)
|
||||
@@ -598,19 +597,6 @@ locals {
|
||||
}
|
||||
```
|
||||
|
||||
For blueprints the prefix is mandatory:
|
||||
|
||||
```hcl
|
||||
variable "prefix" {
|
||||
description = "Prefix used for resource names."
|
||||
type = string
|
||||
validation {
|
||||
condition = var.prefix != ""
|
||||
error_message = "Prefix cannot be empty."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Interacting with checks and tools
|
||||
|
||||
Our modules are designed for composition and live in a monorepo together with several end-to-end blueprints, so it was inevitable that over time we found ways of ensuring that a change does not break consumers.
|
||||
@@ -782,7 +768,7 @@ counts:
|
||||
|
||||
#### Using external files
|
||||
|
||||
In some situations your module might require additional files to properly test it. This is a common situation with modules that implement [factories](blueprints/factories/README.md) that drive the creation of resources from YAML files. If you're in this situation, you can still use example-based tests as described below:
|
||||
In some situations your module might require additional files to properly test it. This is a common situation with modules that implement factories that drive the creation of resources from YAML files. If you're in this situation, you can still use example-based tests as described below:
|
||||
|
||||
- create your regular `hcl` code block example and add the `tftest` directive as described above.
|
||||
- create a new code block with the contents of the additional file and use the `tftest-file` directive. You have to specify a label for the file and a relative path where the file will live.
|
||||
@@ -825,8 +811,6 @@ Here we show a few commonly used selection commands:
|
||||
|
||||
- Run all examples:
|
||||
- `pytest tests/examples`
|
||||
- Run all examples for blueprints only:
|
||||
- `pytest -k blueprints tests/examples`
|
||||
- Run all examples for modules only:
|
||||
- `pytest -k modules tests/examples`
|
||||
- Run all examples for the `net-vpc` module:
|
||||
@@ -835,8 +819,6 @@ Here we show a few commonly used selection commands:
|
||||
- `pytest -k 'modules and net-vpc: and ipv6' tests/examples`
|
||||
- Run a specific example (identified by its full name) from the `net-vpc` module:
|
||||
- `pytest -v 'tests/examples/test_plan.py::test_example[modules/net-vpc:IPv6:1]'`
|
||||
- Run tests for all blueprints except those under the gke directory:
|
||||
- `pytest -k 'blueprints and not gke' tests/examples`
|
||||
|
||||
> [!NOTE]
|
||||
> The colon symbol (`:`) in `pytest` keyword expression `'modules and net-vpc:'` makes sure that `net-vpc` is matched but `net-vpc-firewall` or `net-vpc-peering` are not.
|
||||
@@ -933,12 +915,6 @@ You can use that output to build the inventory file.
|
||||
|
||||
Note that for complex modules, the output can be very large and includes a lot of details about the resources. Extract only those resources and fields that are relevant to your test. There is a fine balance between asserting the critical bits related to your test scenario and including too many details that end up making the test too specific.
|
||||
|
||||
#### Building tests for blueprints
|
||||
|
||||
Generally blueprints are used as top-level modules which means that usually their READMEs include sample values for their variables but there are no examples showing how to use them as modules.
|
||||
|
||||
If you want to test a blueprint using an example, we suggest adding a "Test" section at the end of the README and include the example there. See any existing blueprint for a [concrete example](blueprints/cloud-operations/asset-inventory-feed-remediation#test).
|
||||
|
||||
### Testing via `tfvars` and `yaml` (aka `tftest`-based tests)
|
||||
|
||||
The second approach to testing requires you to:
|
||||
@@ -950,7 +926,7 @@ The second approach to testing requires you to:
|
||||
|
||||
Let's go through each step in succession, assuming you are testing the new `net-lb-app-ext` module.
|
||||
|
||||
First create a new folder under `tests/modules` replacing any dash in the module name with underscores. Note that if you were testing a blueprint the folder would go in `tests/blueprints`.
|
||||
First create a new folder under `tests/modules` replacing any dash in the module name with underscores.
|
||||
|
||||
```bash
|
||||
mkdir tests/modules/net_glb
|
||||
@@ -1365,8 +1341,6 @@ Now open the up-to-date CHANGELOG.md in your favorite editor, and append the new
|
||||
|
||||
## [29.0.0] - 2024-01-24
|
||||
|
||||
### BLUEPRINTS
|
||||
[...]
|
||||
```
|
||||
|
||||
Now scroll to the bottom section of the document, and update the release links by adding `30.0.0` and updating `Unreleased` as follows:
|
||||
|
||||
Reference in New Issue
Block a user