fix(fastly_service_vcl): validate snippet names #673
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
A user can define multiple
snippets
with the samename
attribute.This causes the Fastly API to treat the data using 'last entry wins' behaviour.
Resulting in invalid plan diffs and state changes.
Solution
The Fastly Terraform provider should validate that snippet names are unique.
Notes
I checked the
schema.Schema
type to see if there were any useful validation fields, and although there isValidateFunc
it only validates that specific instance of a block type and so it isn't useful for comparing across separate blocks within a resource.Because of this I had to resort to adding extra validation via the existing
fastly_service_vcl
resource'sCustomizeDiff
.Fixes #672