Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

377
Vistas
how to use ImportValue in parameters?

As I knew, I can use ImportValue to reference value from another cloudformation stack in part of Resources.

NetworkInterfaces:
- GroupSet:
  - Fn::ImportValue:
      Fn::Sub: "${NetworkStackNameParameter}-SecurityGroupID"
  AssociatePublicIpAddress: 'true'
  DeviceIndex: '0'
  DeleteOnTermination: 'true'
  SubnetId:
    Fn::ImportValue:
      Fn::Sub: "${NetworkStackNameParameter}-SubnetID"

But seems this feature can't be used in Parameters

Parameters:
  VPC:
    Description: VPC ID
    Type: String
    Default:
      Fn::ImportValue:
        !Sub "${NetworkStackNameParameter}-VPC"

If I use above way, will get the error:

An error occurred (ValidationError) when calling the CreateChangeSet operation: Template format error: Every Default member must be a string.

Anyway to work around? because the same vpc id, subnet id, security group Id, will be used not only one place.

updates

So I have to give up:

  1. In your AWS CloudFormation template, confirm that the Parameters section doesn't contain any intrinsic functions.

https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-template-validation/

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

One way of doing this is to use a condition:

Parameters:
  MyValue:
    Type: String
    Value: ''
Conditions:
  MyValueExists: !Not [ !Equals [!Ref MyValue, '']]
Resources:
  Resource:
    Type: AWS::Something
    Properties:
      Key: !If [MyValueExists, !Ref MyValue, !ImportValue 'Imported']
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda