From 78220aca72f18cdbadb33404c4da65a7c8fe7ccf Mon Sep 17 00:00:00 2001 From: Michael van Tellingen Date: Thu, 17 Dec 2020 12:17:09 +0100 Subject: [PATCH] Add change key action for channels --- CHANGELOG.md | 4 ++++ commercetools/resource_channel.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1574bd8..31ffc6c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +v0.25.2 (2020-12-17) +==================== + - Implement changing key of an existing channel resource + v0.25.1 (2020-12-05) ==================== - Fix a bug in `resource_type` when the input_hint of a field was modified. diff --git a/commercetools/resource_channel.go b/commercetools/resource_channel.go index 4ef69082..7f6e76d7 100644 --- a/commercetools/resource_channel.go +++ b/commercetools/resource_channel.go @@ -120,6 +120,13 @@ func resourceChannelUpdate(d *schema.ResourceData, m interface{}) error { Actions: []commercetools.ChannelUpdateAction{}, } + if d.HasChange("key") { + newKey := d.Get("key").(string) + input.Actions = append( + input.Actions, + &commercetools.ChannelChangeKeyAction{Key: newKey}) + } + if d.HasChange("name") { newName := commercetools.LocalizedString( expandStringMap(d.Get("name").(map[string]interface{})))