Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

secretmanagerregional: fix managed rotation day-2 updates - #20583

Open
slevenick wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
slevenick:secretmanagerregional-managed-rotation-day2
Open

slevenick wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
slevenick:secretmanagerregional-managed-rotation-day2

Conversation

@slevenick

Copy link
Copy Markdown
Contributor

Expand rotation updateMask paths to leaf schedule fields (rotation.nextRotationTime and rotation.rotationPeriod) on google_secret_manager_regional_secret so Day-2 schedule updates on CLOUD_SQL_DB_CREDENTIALS secrets do not include the output-only rotation.managedRotationStatus subfield. Also add a plan-time CustomizeDiff guard on google_secret_manager_regional_secret_managed_rotation that rejects in-place cloud_sql_single_user_credentials edits on the same secret before Terraform removes state and fails trying to re-enable managed rotation.

Fixes b/590858660

secretmanagerregional: fixed Day-2 `rotation` updates on `google_secret_manager_regional_secret` resources of type `CLOUD_SQL_DB_CREDENTIALS` by sending leaf `rotation.nextRotationTime` and `rotation.rotationPeriod` update mask paths
secretmanagerregional: added plan-time validation on `google_secret_manager_regional_secret_managed_rotation` rejecting in-place `cloud_sql_single_user_credentials` edits on the same secret

@modular-magician

modular-magician commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

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

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 691 insertions(+)
google-beta provider View Diff 5 files changed, 691 insertions(+)
terraform-google-conversion View Diff 4 files changed, 95 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
57 51 3 3
Affected Service Packages
  • secretmanagerregional

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccSecretManagerRegionalRegionalSecretManagedRotation_regionalSecretManagedRotationWriteOnlyExample
  • TestAccSecretManagerRegionalRegionalSecret_cloudSqlRotationUpdate
  • TestAccSecretManagerRegionalRegionalSecret_rotationInfoUpdate

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Findings Test Name
✅ Log - TestAccSecretManagerRegionalRegionalSecret_cloudSqlRotationUpdate
✅ Log - TestAccSecretManagerRegionalRegionalSecret_rotationInfoUpdate
❌ Error · Log 🔴 Nightly passes 100% of 30 TestAccSecretManagerRegionalRegionalSecretManagedRotation_regionalSecretManagedRotationWriteOnlyExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@slevenick VCR tests complete for 412c28f!

@modular-magician

modular-magician commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

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

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 710 insertions(+)
google-beta provider View Diff 5 files changed, 710 insertions(+)
terraform-google-conversion View Diff 4 files changed, 100 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
57 54 3 0
Affected Service Packages
  • secretmanagerregional

Learn how VCR tests work


Step 1: Replaying Mode

🟢 All tests passed in Replaying mode! No Recording was needed.

View the replaying VCR build log

@slevenick VCR tests complete for 024c430!

@slevenick

Copy link
Copy Markdown
Contributor Author

@modular-magician reassign-reviewer

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@rileykarson, 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.

@github-actions
github-actions Bot requested a review from rileykarson December 4, 2026 23:13
// with leaf schedule fields so PATCH does not cover the OUTPUT_ONLY rotation.managedRotationStatus
// subfield on CLOUD_SQL_DB_CREDENTIALS secrets (which Secret Manager rejects with 400
// INVALID_ARGUMENT). Using per-subfield masks also allows updating rotation_period without
// re-validating next_rotation_time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just an API bug, right? Frustrating that we need to sling a bunch of custom code for it.

}
}

func TestExpandSecretManagerRegionalSecretRotationUpdateMask(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ehh, I largely don't think this test is interesting enough to justify itself.

See the License for the specific language governing permissions and
limitations under the License.
*/ -}}
type secretManagerRegionalSecretManagedRotationResourceDiff interface {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a common type we could use instead?

}

func secretManagerRegionalSecretManagedRotationCustomizeDiffFunc(diff secretManagerRegionalSecretManagedRotationResourceDiff) error {
if diff.Id() == "" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a util function that names what I think we're doing- checking if this is create?

Comment on lines +22 to +24
if diff.HasChange("secret_id") || diff.HasChange("location") || diff.HasChange("project") {
return nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these immutable? When do they trigger?

return dst
}

func TestSecretManagerRegionalSecretManagedRotationCustomizeDiff(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's enough modification needed just to write this unit test that I don't personally feel it's very convincing of anything at runtime.

CheckDestroy: testAccCheckSecretManagerRegionalRegionalSecretDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccSecretManagerRegionalSecret_cloudSqlNoRotation(context),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use planchecks

})
}

func TestAccSecretManagerRegionalRegionalSecret_cloudSqlRotationUpdate(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a sample?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants