Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fastly_service_vcl): validate snippet names #673

Merged

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 29, 2023

Problem

A user can define multiple snippets with the same name 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.

Screenshot 2023-03-29 at 12 56 24

Notes

I checked the schema.Schema type to see if there were any useful validation fields, and although there is ValidateFunc 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's CustomizeDiff.

Fixes #672

@Integralist Integralist requested a review from razaj92 March 29, 2023 12:08
@Integralist Integralist merged commit fa11708 into main Mar 29, 2023
@Integralist Integralist deleted the integralist/check-config-for-duplicate-snippet-names branch March 29, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VCL snippet consistency issue
2 participants