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
posta 3 mesi fa121 visualizzazioni
1 Risposta
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

con risposta 3 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande