In cloudformation, want to assign a default value in case if the Fn::ImportValue variable or SSM parameter is not found or not created yet

0

I have a situation like, I wanted to fetch a exported variable from cloudformation export section or from SSM Parameter store. But i have not yet executed the required stack which pushes this variable by any of the means mentioned above. I have to execute the current stack first where it require/import the arn ( bucket arn ) in my current stack but it fails to find the variable. I want to execute this stack with some default or fixed arn and later re execute it when the variable is populated by the later stack. Can we do this? or any solution to overcome this dependency?

khalid
asked 2 months ago111 views
1 Answer
1

If you are deploying the CFN templates manually, then you can have the parameter as a default value initially and then update it after the second stack is deployed...

Something like this:

Parameters:
  BucketARN:
    Type: String
    Description: The ARN of the S3 bucket
    Default: "arn:aws:s3:::example-bucket" # Default or placeholder ARN

Then after second stack is deployed, you can just replace the parameter with !ImportValue and remove this particular parameter

answered 2 months 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