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: put an error message for deleting wo dictionaries #918

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fastly/block_fastly_service_dictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (h *DictionaryServiceAttributeHandler) Update(_ context.Context, _ *schema.
// Delete deletes the resource.
func (h *DictionaryServiceAttributeHandler) Delete(_ context.Context, d *schema.ResourceData, resource map[string]any, serviceVersion int, conn *gofastly.Client) error {
if !resource["force_destroy"].(bool) {
if resource["write_only"].(bool) {
return fmt.Errorf("cannot delete dictionary (%s), it is write_only, so it may contain data. Set force_destroy to true and apply it before making this change", resource["dictionary_id"].(string))
}

mayDelete, err := isDictionaryEmpty(d.Id(), resource["dictionary_id"].(string), conn)
if err != nil {
return err
Expand Down
Loading