Skip to content
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

[BUG] powerscale provider v1.6.0 resource SnapshotSchedule regarding duration/retention. #19

Open
petew-nfx opened this issue Jan 9, 2025 · 0 comments

Comments

@petew-nfx
Copy link

Create snapshot schedule on the cluster with a 6 week duration

# isi snapshot schedule view 4
           ID: 4
         Name: test_dir
         Path: /ifs/test_dir
      Pattern: test_dir:4H_6W::%Y-%m-%d_%H:%M
     Schedule: every 1 days every 4 hours between 12:00 AM and 11:59 PM
     Duration: 6W
        Alias: -
     Next Run: 2025-01-09T16:00:00
Next Snapshot: test_dir:4H_6W::2025-01-09_16:00

Import into terraform

> tf import powerscale_snapshot_schedule.test_dir 4
powerscale_snapshot_schedule.test_dir: Importing from ID "4"...
powerscale_snapshot_schedule.test_dir: Import prepared!
  Prepared powerscale_snapshot_schedule for import
powerscale_snapshot_schedule.test_dir: Refreshing state... [id=4]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

View State after import

> tf state show powerscale_snapshot_schedule.test_dir
# powerscale_snapshot_schedule.test_dir:
resource "powerscale_snapshot_schedule" "test_dir" {
    duration      = 3628800
    id            = "4"
    name          = "test_dir"
    next_run      = 1736467200
    next_snapshot = "test_dir:4H_6W::2025-01-09_16:00"
    path          = "/ifs/test_dir"
    pattern       = "test_dir:4H_6W::%Y-%m-%d_%H:%M"
    schedule      = "every 1 days every 4 hours between 12:00 AM and 11:59 PM"
}

Save state to file and remove/comment out the "id" entry

View the "plan"

> tf plan -target powerscale_snapshot_schedule.test_dir
powerscale_snapshot_schedule.test_dir: Refreshing state... [id=4]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # powerscale_snapshot_schedule.test_dir will be updated in-place
  ~ resource "powerscale_snapshot_schedule" "test_dir" {
      + alias          = (known after apply)
      ~ id             = "4" -> (known after apply)
        name           = "test_dir"
      + retention_time = "1 Week(s)"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

alias and retention_time are not in the state, and "apply" wants to set to retention_time to "1 Week(s)" which does not match the duration in state or cluster.

Running apply

> tf apply -target powerscale_snapshot_schedule.test_dir
powerscale_snapshot_schedule.test_dir: Refreshing state... [id=4]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # powerscale_snapshot_schedule.test_dir will be updated in-place
  ~ resource "powerscale_snapshot_schedule" "test_dir" {
      + alias          = (known after apply)
      ~ id             = "4" -> (known after apply)
        name           = "test_dir"
      + retention_time = "1 Week(s)"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the
│ changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors
│ or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

powerscale_snapshot_schedule.test_dir: Modifying... [id=4]
╷
│ Warning: Applied changes may be incomplete
│
│ The plan was created with the -target option in effect, so some changes requested in the configuration may have been
│ ignored and the output values may not be fully updated. Run the following command to verify that no other changes are
│ pending:
│     terraform plan
│
│ Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as
│ recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to powerscale_snapshot_schedule.test_dir, provider
│ "provider[\"registry.terraform.io/dell/powerscale\"]" produced an unexpected new value: .duration: was
│ cty.NumberIntVal(3.6288e+06), but now cty.NumberIntVal(604800).
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Check the schedule on the cluster

# isi snapshot schedule view 4
           ID: 4
         Name: test_dir
         Path: /ifs/test_dir
      Pattern: test_dir:4H_6W::%Y-%m-%d_%H:%M
     Schedule: every 1 days every 4 hours between 12:00 AM and 11:59 PM
     Duration: 1W
        Alias: -
     Next Run: 2025-01-09T16:00:00
Next Snapshot: test_dir:4H_6W::2025-01-09_16:00

Duration has changed from 6W to 1W.

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

No branches or pull requests

1 participant