Cannot add environment variable through Ebextensions

0

I'm using .ebextensions to create VPCEndpoints so in the Resources section I've addded the needed section for the VPCEndpoint. Then after that in the option_settings section I'm trying to add an environment variable in my elastic beanstalk application referencing the created VPCEndpoint, but when i check the environment variables from the elastic beanstalk console the value is added as a plain text not the Ref of the VPCEndpoint (Check the screenshot) So how can i make it interpret the Ref of the endpoint ?

Enter image description here

Resources:
  NewsonarVPCEndpoint:
    Type: AWS::EC2::VPCEndpoint
    Properties:
      PrivateDnsEnabled: false
      SecurityGroupIds:
        - {"Fn::GetOptionSetting": {"Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "ALLOW_INBOUND_FROM_VPC_SECURITY_GROUP", "DefaultValue": "default_value"}}
      ServiceName: {
              "Fn::Join": [
                "", [
                  "com.amazonaws.vpce.",{"Fn::GetOptionSetting": {"Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "AWS_REGION", "DefaultValue": "us-east-1"}},".",{"Ref": "sonarVPCEndpointService"}]]
            }
      SubnetIds:
        - { "Ref": "Subnet1Id" }
        - { "Ref": "Subnet2Id" }
        - { "Ref": "Subnet3Id" }
      VpcEndpointType: Interface
      VpcId: { "Ref": "VpcId" }


option_settings:
  aws:elasticbeanstalk:application:environment:
    VPC_ENDPOINT: '`{"Ref" : "NewsonarVPCEndpoint"}`'

1 Answer
0

Hello,

If you use an AWS CloudFormation function to define an environment property, the Elastic Beanstalk console displays the value of the property before the function is evaluated. You can use the get-config platform script to confirm the values of environment properties that are available to your application. See Environment properties and other software settings.

AWS
SUPPORT ENGINEER
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions