Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

375
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda