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]: Can't use resources representing Backup Vaults created by AWS for automatic backups #28126

Open
gimbo opened this issue Dec 1, 2022 · 2 comments
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.

Comments

@gimbo
Copy link

gimbo commented Dec 1, 2022

Terraform Core Version

1.3.5

AWS Provider Version

4.41.0

Affected Resource(s)

  • aws_backup_vault

I suspect similar issues may affect other resources, e.g. and in particular aws_backup_plan — but I haven't tested that.

Expected Behavior

I should be able to import any existing Backup Vault into terraform state and use it as normal.

Actual Behavior

Some Backup Vaults created automatically by AWS have names which contain / characters (which are normally prohibited). E.g. when "automatic backups" are enabled on some EFS volume, AWS created a backup vault called aws/efs/automatic-backup-vault.

The aws_backup_vault resource doesn't allow / characters in their names (and again, that's normally the right thing to do because end users can't create such vaults). As such, while I can create a resource for that vault and import its state, I cannot then plan or apply vs that resource without changing its name (which I suspect is not possible anyway for these automatically-created vaults, which also seem to be not deletable).

Relevant Error/Panic Output Snippet

$ terraform import aws_backup_vault.efs_automatic 'aws/efs/automatic-backup-vault'
...
aws_backup_vault.efs_automatic: Importing from ID "aws/efs/automatic-backup-vault"...
aws_backup_vault.efs_automatic: Import prepared!
  Prepared aws_backup_vault for import
...

Import successful!

...

$ terraform plan
╷
│ Error: invalid value for name (must consist of letters, numbers, and hyphens.)
│
│   with aws_backup_vault.efs_automatic,
│   on backup.tf line 10, in resource "aws_backup_vault" "efs_automatic":
│   10:   name        = "aws/efs/automatic-backup-vault"

Terraform Configuration Files

data "aws_kms_key" "aws_backup" {
  key_id = "alias/aws/backup"
}

resource "aws_backup_vault" "efs_automatic" {
  name        = "aws/efs/automatic-backup-vault"
  kms_key_arn = data.aws_kms_key.aws_backup.arn
}

Steps to Reproduce

  1. Create an EFS volume and enable automatic backups (e.g. I used an aws_efs_backup_policy resource).
  2. Verify that a Backup Vault called aws/efs/automatic-backup-vault has been created.
  3. Create a terraform configuration containing an aws_backup_vault resource with that name.
  4. Import the resource (this works).
  5. terraform plan (this fails).

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@gimbo gimbo added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Dec 1, 2022
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/backup Issues and PRs that pertain to the backup service. service/kms Issues and PRs that pertain to the kms service. labels Dec 1, 2022
@ewbankkit ewbankkit removed service/kms Issues and PRs that pertain to the kms service. needs-triage Waiting for first response or review from a maintainer. labels Dec 2, 2022
@burner1024
Copy link

Same for aws_backup_plan, aws_backup_plan/rule, aws_backup_selection.
If there's any other resources in Backup, likely those too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/backup Issues and PRs that pertain to the backup service.
Projects
None yet
Development

No branches or pull requests

3 participants