I have a Boolean called "loose", based on it's value I want to use an existing resource or create one, let say a security group. I would like to avoid using terragrunt.
1 Answer
Yes, Terraform allows you to conditionally create a resource or use a data source based on the value of a variable. You can use the count parameter along with the count function to achieve this.
-
Maybe I wasn't clear. The simple case with count = 0 is not what I am asking. For example if a dns zone exists I dont want to attempt to create one, but if it doesn't I want my resource to be created. Commented Aug 16, 2023 at 16:24