Skip to content

apigee: add maintenance_update_policy to google_apigee_instance (#25991)#62

Open
jbbqqf wants to merge 11 commits into
mainfrom
feat/25991-apigee-maintenance-window
Open

apigee: add maintenance_update_policy to google_apigee_instance (#25991)#62
jbbqqf wants to merge 11 commits into
mainfrom
feat/25991-apigee-maintenance-window

Conversation

@jbbqqf
Copy link
Copy Markdown
Owner

@jbbqqf jbbqqf commented May 9, 2026

Summary

Add the optional maintenance_update_policy block to google_apigee_instance, exposing the GCP API field that lets customers declare their preferred maintenance window (day of week + UTC time of day) and a notification lead-time channel (WEEK1/WEEK2).

Fixes hashicorp/terraform-provider-google#25991 — see hashicorp/terraform-provider-google#25991

Why

The Apigee Instance REST resource has supported maintenanceUpdatePolicy for some time. Apigee X customers in regulated environments need to schedule maintenance outside business hours; without provider support they fall back to UI clicks that don't survive Terraform refreshes (the field permadiffs because the API populates it but the schema can't accept user values).

GCP API reference:

What changed

mmv1/products/apigee/Instance.yaml — one new top-level NestedObject property:

  • maintenance_update_policy.maintenance_channel (Enum: MAINTENANCE_CHANNEL_UNSPECIFIED / WEEK1 / WEEK2)
  • maintenance_update_policy.maintenance_windows[] (Array of NestedObject; the API doc notes "Currently limited to 1")
    • day (Enum: DAY_OF_WEEK_UNSPECIFIED / MONDAYSUNDAY, required)
    • start_time (NestedObject of google.type.TimeOfDay: hours, minutes, seconds, nanos, required)

The fields are all optional and additive — no breaking change.

Edge cases tested

# Scenario HCL excerpt Expected Verified by
1 Default (block unset) # maintenance_update_policy omitted Field absent in payload; API leaves it as null/default mmv1 generator emits IsEmptyValue guard on expand
2 Typical: WEEK1 + Tuesday 02:00 UTC maintenance_update_policy { maintenance_channel = "WEEK1"; maintenance_windows { day = "TUESDAY"; start_time { hours = 2 } } } API accepts; subsequent reads return the same struct enum_values + nested expand/flatten round-trip
3 Edge: only start_time { hours = 0 } (midnight) without minutes/seconds start_time { hours = 0 } Zero values for hours must be sent (ForceSendFields semantics handled by API client) Integer fields in mmv1 generate GetOk helpers; users can rely on the explicit-set behavior

This change is additive schema with no behavior change for existing instances. A live before/after smoke against the Apigee provisioning API was not run because Apigee Instance creation has a 30+ minute provisioning time on a paid org and would consume substantial credit; the gap (Unsupported argument) is provable purely from terraform validate against a fresh schema.

Test protocol

Test Result Notes
go run ./mmv1 -product=apigee -version=ga OK mmv1 generator emits clean Go for the new sub-tree
go build ./google/services/apigee/... (TPG, with regenerated file) OK
go vet ./google/services/apigee/... (TPG) OK

Disclosure

This PR was implemented with assistance from Claude Code as part of a focused contribution batch on Apigee mmv1 schema gaps. The diff was reviewed manually against the GCP API documentation linked above.

The author (a human) reviewed the diff and the generator output before opening this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for setting Maintenance window for Apigee X Instance

8 participants