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

Error updating aws_backup_plan #9502

Closed
ghost opened this issue Jul 25, 2019 · 10 comments · Fixed by #10641
Closed

Error updating aws_backup_plan #9502

ghost opened this issue Jul 25, 2019 · 10 comments · Fixed by #10641
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.
Milestone

Comments

@ghost
Copy link

ghost commented Jul 25, 2019

This issue was originally opened by @totallyben as hashicorp/terraform#22205. It was migrated here as a result of the provider split. The original body of the issue is below.


Trying to modify the schedule on an existing aws_backup_plan results in the following error:

Error: error updating Backup Plan: InvalidParameter: 2 validation error(s) found.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].RuleName.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].TargetBackupVaultName.

Only the schedule has changed and the rule name and target backup vault do exist. The output plan from the apply looks like:

Terraform will perform the following actions:

  # module.aws-backup-plan.aws_backup_plan.hourly-24 will be updated in-place
  ~ resource "aws_backup_plan" "hourly-24" {
        arn     = "xxxxxxxxx"
        id      = "xxxxx"
        name    = "hourly-24"
        tags    = {}
        version = "Yjg2YmYzYWMtYTY3NC00NTBhLTk4ZGEtNGYxMjgyNDI5ZWFi"

      - rule {
          - completion_window   = 180 -> null
          - recovery_point_tags = {
              - "Name" = "hourly-24"
            } -> null
          - rule_name           = "hourly-24" -> null
          - schedule            = "cron(2 * * * ? *)" -> null
          - start_window        = 60 -> null
          - target_vault_name   = "xxxxxx" -> null

          - lifecycle {
              - cold_storage_after = 0 -> null
              - delete_after       = 1 -> null
            }
        }
      + rule {
          + completion_window   = 180
          + recovery_point_tags = {
              + "Name" = "hourly-24"
            }
          + rule_name           = "hourly-24"
          + schedule            = "cron(32 * * * ? *)"
          + start_window        = 60
          + target_vault_name   = "xxxxxx"

          + lifecycle {
              + delete_after = 1
            }
        }
    }

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 25, 2019
@lmasaya
Copy link

lmasaya commented Jul 26, 2019

I encountered this same problem, but updating the start_window of the aws_backup_plan.
It is actually deleting and creating a new rule. Error message:

1 error(s) occurred:

* module.rds_backup.aws_backup_plan.this: 1 error(s) occurred:

* aws_backup_plan.this: error updating Backup Plan: InvalidParameter: 2 validation error(s) found.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].RuleName.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].TargetBackupVaultName.

@gandharkhaladkar
Copy link

Also encounter same problem.
Terraform version 0.11

Error applying plan:\n\n1 error(s) occurred:\n\n* aws_backup_plan.backup: 1 error(s) occurred:\n\n* aws_backup_plan.backup: error updating Backup Plan: InvalidParameter: 2 validation error(s) found.\n- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].RuleName.\n- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].TargetBackupVaultName.

@aeschright aeschright added the service/backup Issues and PRs that pertain to the backup service. label Aug 2, 2019
@alexisde
Copy link

alexisde commented Aug 29, 2019

This is still happening on terraform version 0.12.7 with the 2.25.0 provider

@exavier-slf
Copy link

This is still happening if we create a module and source out the module , it works within a resource

* module.main.module.backup_nd_selection.aws_backup_plan.backup_plan: 1 error(s) occurred:

* aws_backup_plan.backup_plan: error updating Backup Plan: InvalidParameter: 2 validation error(s) found.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].RuleName.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].TargetBackupVaultName.


Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.```

@martcollins
Copy link

I have seen the same issue using AWS provider v2.33, terraform v0.11

I tried to come up with a simple case to reproduce the error and found that the error starts when adding recovery_point_tags to a rule.

Here is an example of a change that does not produce the error.

Start with this resource and create it using terraform apply:

resource "aws_backup_plan" "test_backup_plan" {
  name = "test_backup_plan"

  rule {
    rule_name         = "test_rule"
    target_vault_name = "Default"
    schedule          = "cron(0 0 1 * ? *)"
    start_window      = "120"
  }
}

Now update start_window from 120 to 60 and perform another terraform apply. The resource will be changed successfully.

To reproduce the error, start with the same resource as above, but now add recovery_point_tags as follows. Then create using terraform apply.

resource "aws_backup_plan" "test_backup_plan" {
  name = "test_backup_plan"

  rule {
    rule_name         = "test_rule"
    target_vault_name = "Default"
    schedule          = "cron(0 0 1 * ? *)"
    start_window      = "120"

    recovery_point_tags {
      TestTag = "Testing"
    }
  }
}

Now make the same update as before, e.g. update the start_window from 120 to 60 and do a terraform apply.

This time you get the error:

  aws_backup_plan.test_backup_plan: Modifying... (ID: 2185f92a-9752-44be-aa95-e2657a8475b7)
  rule.3080261210.completion_window:           "180" => "0"
  rule.3080261210.lifecycle.#:                 "0" => "0"
  rule.3080261210.recovery_point_tags.%:       "1" => "0"
  rule.3080261210.recovery_point_tags.TestTag: "Testing" => ""
  rule.3080261210.rule_name:                   "test_rule" => ""
  rule.3080261210.schedule:                    "cron(0 0 1 * ? *)" => ""
  rule.3080261210.start_window:                "60" => "0"
  rule.3080261210.target_vault_name:           "Default" => ""
  rule.3401353882.completion_window:           "" => "180"
  rule.3401353882.lifecycle.#:                 "0" => "0"
  rule.3401353882.recovery_point_tags.%:       "0" => "1"
  rule.3401353882.recovery_point_tags.TestTag: "" => "Testing"
  rule.3401353882.rule_name:                   "" => "test_rule"
  rule.3401353882.schedule:                    "" => "cron(0 0 1 * ? *)"
  rule.3401353882.start_window:                "" => "120"
  rule.3401353882.target_vault_name:           "" => "Default"

Error: Error applying plan:

1 error(s) occurred:

* aws_backup_plan.test_backup_plan: 1 error(s) occurred:

* aws_backup_plan.test_backup_plan: error updating Backup Plan: InvalidParameter: 2 validation error(s) found.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].RuleName.
- missing required field, UpdateBackupPlanInput.BackupPlan.Rules[0].TargetBackupVaultName.

@ewbankkit
Copy link
Contributor

ewbankkit commented Oct 25, 2019

Given that this looks like it's caused by changes to recovery_point_tags, this seems similar to #8431.

@querry43
Copy link

I am encountering this with:

Terraform v0.12.12
provider.aws ~> 2.33

@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 29, 2019
@bflad bflad added this to the v2.34.0 milestone Oct 29, 2019
@bflad
Copy link
Contributor

bflad commented Oct 29, 2019

The fixes for these issues has been merged and will release with version 2.34.0 of the Terraform AWS Provider, on Thursday. Thanks to @ewbankkit for the implementation.

@bflad
Copy link
Contributor

bflad commented Oct 31, 2019

This has been released in version 2.34.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link
Author

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants