Ignore non-existing datasource #1537
-
Hello, We are trying to generate providers and resources list for Terraform based on two sources concatenation
AWS SM secret is created by this Terraform code and it means that at the initial run secret doesn't exist yet and execution fails: gomplate -f main.tf -o - -d secrets_regions=aws+sm:secrets_regions
Is there a way to ignore the error of non-existing datasource? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @air3ijai, thanks for taking the time to post this. (FYI I edited your post to fix a broken link to #1168) I think what you're looking for is the Another option is to use See the docs for examples on how to use these in an |
Beta Was this translation helpful? Give feedback.
Hi @air3ijai, thanks for taking the time to post this.
(FYI I edited your post to fix a broken link to #1168)
I think what you're looking for is the
datasourceReachable
function, which is designed for this type of situation.Another option is to use
datasourceExists
, and simply not specify thesecrets_regions
datasource on the first run (if you know the value won't exist).See the docs for examples on how to use these in an
if
/else
block.