Bug: Fix Compute Disk Snapshot Schedule #476
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the compute disk snapshot schedule module as right now it is requiring all 3 schedule types to be added (see below).
The error I'm encountering indicates that only one of
daily_schedule
,weekly_schedule
, orhourly_schedule
can be specified in a single google_compute_resource_policy resource's schedule block.More info: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_resource_policy#nested_snapshot_schedule_policy
Updated the snapshot variable to ensure that exactly one of daily_schedule, hourly_schedule, or weekly_schedule is provided. It uses a validation rule to enforce that only one of these schedules is specified at a time, preventing any combination of multiple schedules. If none or more than one schedule type is provided, it triggers an error.