databricks-cli/bundle
stikkireddy 3c1e69a064
Update variable regex to support hyphens (#503)
## Changes

Modified interpolation logic to use:
`\$\{([a-zA-Z]+([-_]*[a-zA-Z0-9]+)*(\.[a-zA-Z]+([-_]*[a-zA-Z0-9]+)*)*)\}`

**Edit**: Suggested by @pietern
`\$\{([a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*)*)\}`
to be more selective and not allow consequent hyphens or underscores to
make the keys more readable.

Explanation:
1. All interpolation starts with `${` and ends with `}`
2. All interpolated locations are split by by `.`
3. All sections are expected to start with a alphabet `[a-zA-Z]`; no
numbers, hyphens or underscores.
4. All sections are expected to end with an alphanumeric `[a-zA-Z0-9]`
no hyphens or underscores

This change allows the current interpolation to be more permissive.

**Note** it does break backwards compatibility because `[a-zA-Z] !=
[\w]`. `\w` includes alphanumeric and underscores. `\w = [a-zA-Z0-9_]`

## Tests
There are two tests with examples of valid and invalid interpolation and
a test to validate expansion.
2023-06-23 12:56:54 +02:00
..
artifacts Bump github.com/databricks/databricks-sdk-go from 0.9.1-0.20230614092458-b5bbc1c8dabb to 0.10.0 (#497) 2023-06-21 07:43:07 +00:00
config Update variable regex to support hyphens (#503) 2023-06-23 12:56:54 +02:00
deploy Fix locker unlock for destroy (#492) 2023-06-19 15:57:25 +02:00
deployer Fix locker unlock for destroy (#492) 2023-06-19 15:57:25 +02:00
internal/tf Update Terraform provider schema structs (#504) 2023-06-21 08:40:11 +02:00
phases Fix locker unlock for destroy (#492) 2023-06-19 15:57:25 +02:00
run Update with the latest Go SDK (#457) 2023-06-12 14:23:21 +02:00
schema Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
tests Check for nil environment before accessing it (#453) 2023-06-08 20:55:49 +00:00
bundle.go Add DATABRICKS_BUNDLE_TMP env variable (#462) 2023-06-21 09:53:54 +02:00
bundle_test.go Add DATABRICKS_BUNDLE_TMP env variable (#462) 2023-06-21 09:53:54 +02:00
context.go Make sync command work in bundle context; reorder args (#207) 2023-02-20 11:33:30 +01:00
context_test.go Add command that writes the materialized bundle configuration to stdout (#95) 2022-11-21 15:39:53 +01:00
deferred.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
deferred_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
mutator.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
mutator_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
root.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
root_test.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
seq.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
seq_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00