Search code examples
amazon-web-servicesterraformamazon-elastic-beanstalkterraform-provider-aws

Pass Elastic Beanstalk configuration without = sign


So I am trying to turn on the G1 garbage collector using the terraform config template: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elastic_beanstalk_configuration_template#setting

All I need to do is pass in -XX:+UseG1GC to the JVM options, but I am getting an = sign injected between the name and value (and value is required).

Any tips are appreciated!


Solution

  • Looking at the Elastic Beanstalk documentation [1], it seems that if you need to pass a specific JVM option you need to use that as the name, i.e.:

    resource "aws_elastic_beanstalk_configuration_template" "yourappname" {
      name                = "<yourconfigtemplatename>"
      application         = "<yourbeanstalkapplicationname>"
    
      setting {
        namespace = "aws:elasticbeanstalk:container:tomcat:jvmoptions"
        name      = "JVM Options"
        value     = "-XX:+UseG1GC"
      }
    }
    

    As I am not a Beanstalk expert it might require a coupe of iterations to get it right.

    EDIT: As per Mark B's comment, I was missing a hyphen in the value, so I have added that as well.


    [1] https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-specific.html#command-options-java