Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new fields within deidentify_config field of google_data_loss_prevention_deidentify_template resource #13282

Conversation

modular-magician
Copy link
Collaborator

Description

Part of #9836

This PR adds more fields to the google_data_loss_prevention_deidentify_template resource [provider docs] under the (already implemented) deidentify_config field [API docs].

The deidentifyConfig.infoTypeTransformations.* fields are already in the resource.

This PR adds:

  • deidentifyConfig.recordTransformations.fieldTransformations, and these subfields within:
    • fields.* - all subfields
    • condition.* - all subfields
    • primitiveTransformation.replaceConfig
    • primitiveTransformation.redactConfig
    • primitiveTransformation.characterMaskConfig

I'm going to add more primitiveTransformation subfields in future but I wanted to keep the PR size small.

List

If this PR is for Terraform, I acknowledge that I have:

  • 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).
  • Generated Terraform, and ran make test and make 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).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

dlp: Added field `deidentify_config.record_transformations.field_transformations.fields` to `google_data_loss_prevention_deidentify_template`
dlp: Added field `deidentify_config.record_transformations.field_transformations.condition` to `google_data_loss_prevention_deidentify_template`
dlp: Added field `deidentify_config.record_transformations.field_transformations.primitive_transformation.replace_config` to `google_data_loss_prevention_deidentify_template`
dlp: Added field `deidentify_config.record_transformations.field_transformations.primitive_transformation.redact_config` to `google_data_loss_prevention_deidentify_template`
dlp: Added field `deidentify_config.record_transformations.field_transformations.primitive_transformation.character_mask_config` to `google_data_loss_prevention_deidentify_template`

Derived from GoogleCloudPlatform/magic-modules#6872

…prevention_deidentify_template` resource (hashicorp#6872)

* Start adding `recordTransformations` field, make mutually exclusive with `infoTypeTransformations`

This stops `infoTypeTransformations` being required - not a breaking change?

* Add `recordTransformationsfieldTransformations.fields.*` fields

* Add `recordTransformationsfieldTransformations.condition.*` fields and validation

Note: this is a repeat of something already in the file but they differ by use of `exactly_one_of`.

* Add `recordTransformations.fieldTransformations.primitiveTransformation.replaceConfig.*` fields and validation

* Add `recordTransformations.fieldTransformations.primitiveTransformation.redactConfig.*` fields

* Make 'values' fields in `confitions` and `replaceConfig` fields both have exactly_one_of restrictions and same descriptions

* Add comments about `exactly_one_of` entries that are yet to be implemented

* Fix mistake - `redactConfig` is meant to be an empty object, attribute properties in yaml to `characterMaskConfig` field instead

* Update existing DeidentifyTemplate tests to reflect use of `infoTypeTransformations` field

* Add new DeidentifyTemplate test that uses implemented `recordTransformations` fields

* Fix unclosed strings in acceptance test

* Fix error in generating `exactly_one_of` entries

* Fix error where `fieldTransformations` should be an array, remove incompatible use of `exactly_one_of`

A bug in the SDK means that `exactly_one_of` doesn't work with fields nested within arrays

* Refactor and rename tests

* go fmt

* Update test name to allow multiple tests that set `recordTransformations`

* Allow empty `redactConfig` object to be sent to API

* Add acceptance test for use of `redactConfig` transformation

* Update `replaceConfig` config test to add a second condition

To check for any reordering by the API

* Add acceptance test for use of `characterMaskConfig` transformation

* go fmt

* MAke `primitiveTransformation` a required field

* Remove ineffective `exactly_one_of` blocks

These currently create empty ExactlyOneOf lists in the downstream

* Update descriptions for `redactConfig`, `characterMaskConfig`

* Refactor acceptance tests into single `recordTransformations` test

Tests `replace_config`, `redact_config` and `character_mask_config`

* Update docs after feedback

* Add missing validation for `replace_config.new_value` fields

* Update acc tests to include removal of blocks

Test removal of field_transformations, conditions

* Update docs to show that primitive_transformation is a union field

* Update mmv1/products/dlp/api.yaml

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>

* Update mmv1/products/dlp/api.yaml

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 6b99075 into hashicorp:main Dec 19, 2022
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant