feat: add functionality to do a patch apply with exclusions
What
- add
terra-transformer protected-apply --patchfunctionality generate targets on current state with exclusions. - upgrade to the latest shunit
- make tests extract XMLs and format them nicely, e.g of a test report with failures: https://gitlab.com/gitlab-com/gl-infra/terra-transformer/-/pipelines/1995335460/test_report => this is much nicer than several thousands of lines of unformatted shell output.
Why
The resulting list of targets is a "patch" on top of the existing state, rather than a full terraform plan. This allows for terraform patches to be appleid to the remaining items in the state in the scenarios such as:
- A whole AWS region is out, and none of the API endpoints can be called.
- Resources are corrupt and cannot be targeted,
datalookups are likely to fail.
Examples of output of the filtered targets is in internal/terraform/patchtargets/patch-target-extractor_test.go
Further background in relation to GitLab Dedicated: https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/team/-/issues/8080
Closes: https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/team/-/work_items/9617
Edited by Konst Tchernov