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
Create an EFS volume and enable automatic backups (e.g. I used an aws_efs_backup_policy resource).
Verify that a Backup Vault called aws/efs/automatic-backup-vault has been created.
Create a terraform configuration containing an aws_backup_vault resource with that name.
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.
Terraform Core Version
1.3.5
AWS Provider Version
4.41.0
Affected Resource(s)
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 calledaws/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 thenplan
orapply
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 Configuration Files
Steps to Reproduce
aws_efs_backup_policy
resource).aws/efs/automatic-backup-vault
has been created.aws_backup_vault
resource with that name.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