_This issue was originally opened by @jffry as hashicorp/terraform#13335. It was migrated here as part of the provider split. The original body of the issue is below._
If you are using Terraform to manage an aws_elastic_beanstalk_application_version, you will be unable to refresh state or apply plans if one or more other beanstalk applications (aside from the one you are managing) contains an application version named the same as the one you are managing with Terraform.
v0.9.2
#something like this. note that it's two separate elastic beanstalk applications (app1 and app2)
resource "aws_elastic_beanstalk_application_version" "setup1" {
application = "app1"
bucket = "bucket1"
key = "first-time-setup.zip"
name = "first-time-setup"
}
resource "aws_elastic_beanstalk_application_version" "setup2" {
application = "app2"
bucket = "bucket2"
key = "first-time-setup.zip"
name = "first-time-setup"
}
After a terraform apply, a terraform refresh should run fine and be able to create these.
Error messages like Error reading application version properties: found 2 application versions, expected 1 (comes from this)
This is happening because Terraform is only keying on the application version name when trying to list existing application versions (see this).
This means that if you have a Terraform-managed application version in one Beanstalk application, you cannot have any application versions with the same name in any of your other Beanstalk applications, or Terraform will throw this error.
Could Terraform perhaps also key on the application name when refreshing the Beanstalk Application Version's state? E.g. also pass an ApplicationName to DescribeApplicationVersionsInput?
Just cook up a scheme to make the application version names unique (e.g. I'm suffixing the beanstalk app name, so in my example above, name = "first-time-setup" becomes name = "first-time-setup--app2")
Any idea how to recover once the error has occurred? ie. removing the duplicate versions? @jffry?
Answering my own question: delete or rename the application versions manually (on AWS)
@robinbowes having the same issue, there's got to be a better solution.
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
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!
Most helpful comment
Any idea how to recover once the error has occurred? ie. removing the duplicate versions? @jffry?
Answering my own question: delete or rename the application versions manually (on AWS)