Which newer string functions replace clumsy regex checks?
IntermediateConceptLoops, Conditionals, Dynamic Blocks and Functions
Answer
startswith(str, prefix) and endswith (1.3), strcontains(str, substr) (1.5), plus trimprefix, trimsuffix and format. They make validations readable and avoid regex mistakes.
condition = startswith(var.bucket_name, "acme-") && !strcontains(var.bucket_name, "_")
More on Loops, Conditionals, Dynamic Blocks and Functions
How does `count` work?BeginnerHow does `for_each` work?BeginnerWhen should you choose `for_each` over `count`?IntermediateHow do you use `for_each` with a list of objects?IntermediateWhat does "The for_each value depends on resource attributes that cannot be determined until apply" mean?AdvancedHow do you create a resource conditionally?Beginner