magic-modules
magic-modules copied to clipboard
Add custom logic for handling `_Default` and `_Required` for `google_logging_project_sink`
This PR adds logic to handle _Default
and _Required
singleton log sinks for google_logging_project_sink
.
The logic is similar to google_logging_project_bucket_config
where terraform would import those sinks on creation and remove from the state on deletion. Automatic imports of this resource is particularly helpful in a couple of use cases such as:
- Handling log regionality: for an organization with a lot of projects, manual importing of the log routers to route a specific log bucket is not feasible.
This PR is heavily inspired by https://github.com/hashicorp/terraform-provider-google/pull/9903/files but adapts it to the magic-modules repo and reduces the scope for simpler deployment. There's also an additional complexity to handle a case where these buckets are removed by using the new organization default settings.
If this PR is for Terraform, I acknowledge that I have:
- [x] Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
- [x] Generated Terraform, and ran
make test
andmake lint
to ensure it passes unit and linter tests. - [ ] Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
- [ ] Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
- [x] Read the Release Notes Guide before writing my release note below.
Release Note Template for Downstream PRs (will be copied)
logging: improve handling or `_Default` and `_Required` for `google_logging_project_sink`