There was a ticket, #3955 but it was closed without any fix. The issue is still present.
Terraform v0.12.6
provider "aws" {
region = "eu-west-1"
}
resource "aws_elastic_beanstalk_application" "tftest" {
name = "tf-eb-rds-test-1"
description = "App to test EB env with rds cration "
}
resource "aws_elastic_beanstalk_environment" "tfenvtest" {
name = "tf-test-name-1"
application = "${aws_elastic_beanstalk_application.tftest.name}"
solution_stack_name = "64bit Amazon Linux 2018.03 v3.2.1 running Tomcat 8.5 Java 8"
setting {
namespace = "aws:rds:dbinstance"
name = "DBEngine"
value = "postgres"
}
setting {
namespace = "aws:rds:dbinstance"
name = "DBEngineVersion"
value = "10"
}
setting {
namespace = "aws:rds:dbinstance"
name = "DBUser"
value = "postgresss"
}
setting {
namespace = "aws:rds:dbinstance"
name = "DBPassword"
value = "123456"
}
setting {
namespace = "aws:rds:dbinstance"
name = "DBDeletionPolicy"
value = "Snapshot"
}
setting {
namespace = "aws:rds:dbinstance"
name = "DBAllocatedStorage"
value = "10"
}
setting {
namespace = "aws:rds:dbinstance"
name = "DBInstanceClass"
value = "t3.small"
}
}
https://gist.github.com/jkolobok/d20749ee48bfa31038b410394f255fe4
Elastic beanstalk environment with RDS instance attached to it will be created
TF creates EB environment without RDS at all
terraform applyPlease vote on this issue by adding a +1 reaction to the original issue to help the community and maintainers prioritize this request
I can't add a reaction to the original issue. I suspect that is because it is closed, so I doubt anyone can. I added a +1 to this instead. Let me know if there is a better way for me or others to vote for this.
Same thing happens with:
$ terraform -version
Terraform v0.12.28
As soon as I got it is not enough to set RDS related options.
AWS WebConsole uses TemplateSpecification field. The field contains CloudFormation snippet which creates RDS.
Example of the snippet: https://s3.eu-west-1.amazonaws.com/elasticbeanstalk-env-resources-eu-west-1/eb_snippets/rds/rds.json
And if you take a look at eb cli code you also find TemplateSpecification:
https://github.com/aws/aws-elastic-beanstalk-cli/blob/4b68bc370aedce6e09297ad50b59a3cf16d5eda3/ebcli/lib/elasticbeanstalk.py#L278-L286
I think the same logic should be implemented in provider.
Most helpful comment
Same thing happens with:
$ terraform -version
Terraform v0.12.28