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
已提問 3 個月前檢視次數 120 次
1 個回答
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

已回答 3 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南