You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is missing optional parameter in submodule compute_disk_snapshot variables. snapshot_schedule originally accepts only one of: daily_schedule, hourly_schedule or weekly_schedule but in module it requests to define them all.
Then after plan I expect to create resources related to module
so in this particular example I have a one VM with two disks: boot and data
and it should create snapshot policy with attachment to both.
Observed behavior
When I'll set only one schedule (MARK: I kept others in errors commented for visibility)
│ Error: Invalid combination of arguments
│
│ with module.vm["<instance_name>"].module.disk_snapshots[0].google_compute_resource_policy.policy,
│ on .terraform/modules/vm.disk_snapshots/modules/compute_disk_snapshot/main.tf line 34, in resource "google_compute_resource_policy" "policy":
│ 34: schedule {
│
│ "snapshot_schedule_policy.0.schedule.0.daily_schedule": only one of
│ `snapshot_schedule_policy.0.schedule.0.daily_schedule,snapshot_schedule_policy.0.schedule.0.hourly_schedule,snapshot_schedule_policy.0.schedule.0.weekly_schedule`
│ can be specified, but
│ `snapshot_schedule_policy.0.schedule.0.daily_schedule,snapshot_schedule_policy.0.schedule.0.hourly_schedule,snapshot_schedule_policy.0.schedule.0.weekly_schedule`
│ were specified.
╵
╷
│ Error: Invalid combination of arguments
│
│ with module.vm["<instance_name>"].module.disk_snapshots[0].google_compute_resource_policy.policy,
│ on .terraform/modules/vm.disk_snapshots/modules/compute_disk_snapshot/main.tf line 34, in resource "google_compute_resource_policy" "policy":
│ 34: schedule {
│
│ "snapshot_schedule_policy.0.schedule.0.hourly_schedule": only one of
│ `snapshot_schedule_policy.0.schedule.0.daily_schedule,snapshot_schedule_policy.0.schedule.0.hourly_schedule,snapshot_schedule_policy.0.schedule.0.weekly_schedule`
│ can be specified, but
│ `snapshot_schedule_policy.0.schedule.0.daily_schedule,snapshot_schedule_policy.0.schedule.0.hourly_schedule,snapshot_schedule_policy.0.schedule.0.weekly_schedule`
│ were specified.
╵
╷
│ Error: Invalid combination of arguments
│
│ with module.vm["<instance_name>"].module.disk_snapshots[0].google_compute_resource_policy.policy,
│ on .terraform/modules/vm.disk_snapshots/modules/compute_disk_snapshot/main.tf line 34, in resource "google_compute_resource_policy" "policy":
│ 34: schedule {
│
│ "snapshot_schedule_policy.0.schedule.0.weekly_schedule": only one of
│ `snapshot_schedule_policy.0.schedule.0.daily_schedule,snapshot_schedule_policy.0.schedule.0.hourly_schedule,snapshot_schedule_policy.0.schedule.0.weekly_schedule`
│ can be specified, but
│ `snapshot_schedule_policy.0.schedule.0.daily_schedule,snapshot_schedule_policy.0.schedule.0.hourly_schedule,snapshot_schedule_policy.0.schedule.0.weekly_schedule`
│ were specified.
So the error says that I have to use only one of those possibilities.
Terraform Configuration
- Installing hashicorp/google v4.85.0...- Installed hashicorp/google v4.85.0 (signed by HashiCorp)
- Installing hashicorp/null v3.2.3...- Installed hashicorp/null v3.2.3 (signed by HashiCorp)
Terraform Version
Terraform v1.6.3
on linux_amd64
terragrunt version v0.53.2
Additional information
I forked this locally to check what can be done.
It just require a small improvement by adding optional( ) attribute for them as below.
variable "snapshot_schedule" {
description = "The scheduled to be used by the snapshot policy. For more details see https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_resource_policy#schedule"
type = object(
{
daily_schedule = optional(object(
{
days_in_cycle = number
start_time = string
}
))
hourly_schedule = optional(object(
{
hours_in_cycle = number
start_time = string
}
))
weekly_schedule = optional(object(
{
day_of_weeks = set(object(
{
day = string
start_time = string
}
))
}
))
}
)
}
The text was updated successfully, but these errors were encountered:
TL;DR
There is missing
optional
parameter in submodulecompute_disk_snapshot
variables.snapshot_schedule
originally accepts only one of:daily_schedule, hourly_schedule or weekly_schedule
but in module it requests to define them all.Expected behavior
Then after plan I expect to create resources related to module
so in this particular example I have a one VM with two disks:
boot
anddata
and it should create snapshot policy with attachment to both.
Observed behavior
When I'll set only one schedule (MARK: I kept others in errors commented for visibility)
Then I have an error:
To satisfy the requirements I set them all
And I got following error
So the error says that I have to use only one of those possibilities.
Terraform Configuration
Terraform Version
Additional information
I forked this locally to check what can be done.
It just require a small improvement by adding
optional( )
attribute for them as below.The text was updated successfully, but these errors were encountered: