I need to check in terraform if a floating ip resource with a specific ip address has been yet allocated. I’ve tryed to use terraform datasources to do it but the problem is that when the resource is not found an exception is thrown and the azure pipeline stop working.
Is there a way to do that check catching the error or using another approach?
Thanks in advance.
N.
Note: terraform is calling openstack api to work with the infrastructure (ibm icic)
2
Answers
No, there is no such way from terraform, as TF does not provide tools to conditionally check if a resource exist or not. You have to check it outside of TF by developing some script for that, for example in python, and then passing the outcome of the script (true, false) as an input argument to TF.
Terraform does not have such a construct… But.
Here’s a trick (untested, you’ll let me know) that may save the day:
uuid()
as a trigger to always run it0
or1
for your dataLMK how that goes?!