Skip to content

feat: implementation of write_only support for sensitive_labels #13847

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ramonvermeulen
Copy link
Contributor

@ramonvermeulen ramonvermeulen commented May 4, 2025

Solves: hashicorp/terraform-provider-google#21855

First time implementing a write_only attribute, took a look at bigquery_data_transfer for inspiration.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

monitoring: added `write-only` support for `sensitive_labels` via `sensitive_labels_wo` for `monitoring_notification_channel` resource

@ramonvermeulen ramonvermeulen force-pushed the ramon/21855-monitoring-sensitive-labels-wo-support branch from 40793c2 to e7a1b9d Compare May 4, 2025 11:42
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label May 4, 2025
@ramonvermeulen
Copy link
Contributor Author

Tested manually, and the write-only attributes are not written to the tfstate file. I am struggling with getting the tests to work, even though ImportStateVerifyIgnore is configured, I get the following error:

image

Upgrading PR from draft to review to get some feedback/supports on correcting the tests.

@ramonvermeulen ramonvermeulen marked this pull request as ready for review May 4, 2025 15:42
@github-actions github-actions bot requested a review from trodge May 4, 2025 15:43
Copy link

github-actions bot commented May 4, 2025

Hello! I am a robot. Tests will require approval from a repository maintainer to run. Googlers: see go/terraform-auto-test-runs to set up automatic test runs.

@trodge, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@ramonvermeulen ramonvermeulen force-pushed the ramon/21855-monitoring-sensitive-labels-wo-support branch from 86f2b59 to 6538faa Compare May 5, 2025 09:56
@ramonvermeulen ramonvermeulen changed the title feat: first implementation of write_only support for sensitive_labels feat: implementation of write_only support for sensitive_labels May 5, 2025
@modular-magician modular-magician added service/monitoring-alerting and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels May 7, 2025
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 265 insertions(+), 19 deletions(-))
google-beta provider: Diff ( 5 files changed, 265 insertions(+), 19 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 5 insertions(+), 4 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_monitoring_notification_channel (16 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_monitoring_notification_channel" "primary" {
  sensitive_labels_wo {
    auth_token_wo         = # value needed
    auth_token_wo_version = # value needed
  }
}

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_monitoring_notification_channel
    • Expected Document Path: /website/docs/r/monitoring_notification_channel.html.markdown
    • Fields: [sensitive_labels_wo.auth_token_wo sensitive_labels_wo.auth_token_wo_version sensitive_labels_wo.password_wo sensitive_labels_wo.password_wo_version sensitive_labels_wo.service_key_wo sensitive_labels_wo.service_key_wo_version]

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 59
Passed tests: 55
Skipped tests: 3
Affected tests: 1

Click here to see the affected service packages
  • monitoring

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

Copy link

github-actions bot commented May 8, 2025

@trodge This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label May 9, 2025
@ramonvermeulen
Copy link
Contributor Author

After taking another look at the bigquery_data_transfer managed to resolve the issues:

❮ make testacc TEST=./google/services/monitoring TESTARGS='-run=TestAccMonitoringNotificationChannel_'
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google/services/monitoring -v -run=TestAccMonitoringNotificationChannel_ -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN   TestAccMonitoringNotificationChannel_notificationChannelBasicExample
=== PAUSE TestAccMonitoringNotificationChannel_notificationChannelBasicExample
=== RUN   TestAccMonitoringNotificationChannel_update
=== PAUSE TestAccMonitoringNotificationChannel_update
=== RUN   TestAccMonitoringNotificationChannel_updateLabels_slack
    resource_monitoring_notification_channel_test.go:43:
--- SKIP: TestAccMonitoringNotificationChannel_updateLabels_slack (0.00s)
=== RUN   TestAccMonitoringNotificationChannel_updateLabels
=== PAUSE TestAccMonitoringNotificationChannel_updateLabels
=== RUN   TestAccMonitoringNotificationChannel_updateSensitiveLabels_slack
    resource_monitoring_notification_channel_test.go:93:
--- SKIP: TestAccMonitoringNotificationChannel_updateSensitiveLabels_slack (0.00s)
=== RUN   TestAccMonitoringNotificationChannel_updateSensitiveLabels
=== PAUSE TestAccMonitoringNotificationChannel_updateSensitiveLabels
=== RUN   TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo
=== PAUSE TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo
=== RUN   TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo_slack
    resource_monitoring_notification_channel_test.go:191:
--- SKIP: TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo_slack (0.00s)
=== CONT  TestAccMonitoringNotificationChannel_notificationChannelBasicExample
=== CONT  TestAccMonitoringNotificationChannel_updateSensitiveLabels
=== CONT  TestAccMonitoringNotificationChannel_updateLabels
=== CONT  TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo
=== CONT  TestAccMonitoringNotificationChannel_update                                                                                                                    
--- PASS: TestAccMonitoringNotificationChannel_updateSensitiveLabels (176.90s)
--- PASS: TestAccMonitoringNotificationChannel_updateLabels (184.20s)
--- PASS: TestAccMonitoringNotificationChannel_notificationChannelBasicExample (186.17s)
--- PASS: TestAccMonitoringNotificationChannel_update (192.98s)
--- PASS: TestAccMonitoringNotificationChannel_updateSensitiveLabelsWo (199.22s)
PASS
ok      github.com/hashicorp/terraform-provider-google/google/services/monitoring       199.887s

Copy link

@GoogleCloudPlatform/terraform-team @trodge This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-approval Pull requests that need reviewer's approval to run presubmit tests service/monitoring-alerting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants