importValue function does not work in cloudformation

Viewed 1930

I see a very strange issue with cloud formation import value function in cloudformation. I am trying to create a cloudformation beanstalk environment. in the configurationTemplate section I have :

 configurationTemplateChannel:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
  ApplicationName:
  - Fn::ImportValue:
      Fn::Sub: "${StackNamePrefix}-BeanstalkId-test"
  Description: AWS ElasticBeanstalk Sample Configuration Template
  OptionSettings:
       .
       .
       .         
  - Namespace: aws:ec2:vpc
    OptionName: VPCId
    Value:
      Fn::ImportValue:
        Fn::Sub: "${StackNamePrefix}-vpc-VpcId"
     .
     .
     .

As you see I have import in ApplicationName which result in:

An error occurred (ValidationError) when calling the CreateStack operation: [/Re                    sources/configurationTemplateChannel/Type/OptionSettings/6/Value/0/Fn::ImportVal                    ue] 'null' values are not allowed in templates

Am I doing anything wrong? Does this mean that I cannot use import option here?

Any help would be appreciated

1 Answers

For further readers: I found the issue when I replace it with Fn::ImportValue: !Sub ${StackNamePrefix}-BeanstalkId-test it works

Related