terraformamazon-elastic-beanstalk

setting a multi-line value in terraform variables


I'm trying to deploy a beanstalk and use this as part of the aws_elastic_beanstalk_environment terraform resource:

  setting {
    namespace = "aws:elb:policies:PublicKey"
    name      = "PublicKey"
    value     = var.PUBLICKEY

The value of the var.PUBLICKEY should be in this format:

-----BEGIN PUBLIC KEY-----
sajldlkuewindasmASL/aisudoiasumasdnowqeuoi@kajsdlkausKJDolkejpwr
sajldlkuewindasmASL/aisudoiasumasdnowqeuoi@kajsdlkausKJDolkejpwr
sajldlkuewindasmASL/aisudoiasumasdnowqeuoi@kajsdlkausKJDolkejpwr
sajldlkuewindasmASL/aisudoiasumasdnowqeuoi@kajsdlkausKJDolkejpwr
sajldlkuewindasmASL/aisudoiasumasdnowqeuoi@kajsdlkausKJDolkejpwr
sajldlkuewindasmASL/aisudoiasumasdnowqeuoi@kajsdlkausKJDolkejpwr
asdhjasd
-----END PUBLIC KEY-----

May I ask if you have tried to set a variable with this kind of format? Or is terraform allow to use this kind of format as a variable on tfvars section?


Solution

  • The value of the PublicKey should be a single line string without -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- as shown in the AWS docs.