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

Advanced Backup Setting Arguments backup_options is not optional #17667

Closed
lassebenni opened this issue Feb 17, 2021 · 4 comments · Fixed by #17692
Closed

Advanced Backup Setting Arguments backup_options is not optional #17667

lassebenni opened this issue Feb 17, 2021 · 4 comments · Fixed by #17692
Assignees
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.
Milestone

Comments

@lassebenni
Copy link

lassebenni commented Feb 17, 2021

Terraform CLI and Terraform AWS Provider Version

Terraform v0.14.7

Affected Resource(s)

aws_backup_plan

Terraform Configuration Files

resource "aws_backup_plan" "example" {
  name = "tf_example_backup_plan"

  rule {
    rule_name         = "tf_example_backup_rule"
    target_vault_name = aws_backup_vault.test.name
    schedule          = "cron(0 12 * * ? *)"
  }

  advanced_backup_setting {
    resource_type = "EC2"
  }
}

Debug Output

Error: error creating Backup Plan: MissingParameterValueException: Resource Type or Backup Options is null in Advanced Backup Settings
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "1a493370-ed04-4ca7-93d3-14d58e2c8862"
  },
  Code_: "ERROR_4214",
  Message_: "Resource Type or Backup Options is null in Advanced Backup Settings"
}

Expected Behavior

Creation of aws_backup_plan resource without stating the backup_options argument.

Actual Behavior

tf plan produces the error that states that the backup_options argument inside advanced_backup_setting is required, which is unlike what is stated in the documentation:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/backup_plan#advanced-backup-setting-arguments

But in the latest docs of CloudFormation it states that the BackupOptions argument IS required: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-backup-backupplan-advancedbackupsettingresourcetype.html

Steps to Reproduce

  1. terraform apply
@ghost ghost added the service/backup Issues and PRs that pertain to the backup service. label Feb 17, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 17, 2021
@ewbankkit
Copy link
Contributor

@ewbankkit
Copy link
Contributor

@lassebenni Thanks for raising this issue.
Indeed, the AWS Backup API Reference states backup options are optional but I can reproduce the error you got with a modified acceptance test:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsBackupPlan_AdvancedBackupSetting'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsBackupPlan_AdvancedBackupSetting -timeout 120m
=== RUN   TestAccAwsBackupPlan_AdvancedBackupSetting
=== PAUSE TestAccAwsBackupPlan_AdvancedBackupSetting
=== CONT  TestAccAwsBackupPlan_AdvancedBackupSetting
    resource_aws_backup_plan_test.go:533: Step 1/3 error: Error running apply: exit status 1
        2021/02/18 17:48:26 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.13.0
        
        Error: error creating Backup Plan: MissingParameterValueException: Resource Type or Backup Options is null in Advanced Backup Settings
        {
          RespMetadata: {
            StatusCode: 400,
            RequestID: "aab23569-3c28-4c67-933b-8a02b320b349"
          },
          Code_: "ERROR_4214",
          Message_: "Resource Type or Backup Options is null in Advanced Backup Settings"
        }
        
        
--- FAIL: TestAccAwsBackupPlan_AdvancedBackupSetting (8.17s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	8.264s
FAIL
GNUmakefile:27: recipe for target 'testacc' failed
make: *** [testacc] Error 1

I'll fix the resource so that backup_options and resource_type are both Required.

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 18, 2021
@ewbankkit ewbankkit self-assigned this Feb 18, 2021
@github-actions github-actions bot added this to the v3.30.0 milestone Feb 23, 2021
@ghost
Copy link

ghost commented Feb 26, 2021

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 25, 2021

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 as resolved and limited conversation to collaborators Mar 25, 2021
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
2 participants