Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

376
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!