From 6a84136ef83f6905d01ef621d3f8cef0a9916e80 Mon Sep 17 00:00:00 2001 From: ziyeqf Date: Tue, 28 Feb 2023 12:41:18 +0800 Subject: [PATCH 1/5] `azurerm_media_services_account`: crash #20645 fix --- internal/services/media/media_services_account_resource.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/services/media/media_services_account_resource.go b/internal/services/media/media_services_account_resource.go index 00ebeee11179..02afc4f63d32 100644 --- a/internal/services/media/media_services_account_resource.go +++ b/internal/services/media/media_services_account_resource.go @@ -527,7 +527,10 @@ func expandMediaServicesAccountKeyDelivery(input []interface{}) *accounts.KeyDel return nil } - keyDelivery := input[0].(map[string]interface{}) + keyDelivery, ok := input[0].(map[string]interface{}) + if !ok { + return nil + } defaultAction := keyDelivery["default_action"].(string) var ipAllowList *[]string From 8c8a5d6e44c18368e6e92ee494f2bde9d8f3b580 Mon Sep 17 00:00:00 2001 From: ziyeqf Date: Tue, 28 Feb 2023 13:51:35 +0800 Subject: [PATCH 2/5] force update to trigger ci --- internal/services/media/media_services_account_resource_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/media/media_services_account_resource_test.go b/internal/services/media/media_services_account_resource_test.go index a7663acc05c4..8460fe141abb 100644 --- a/internal/services/media/media_services_account_resource_test.go +++ b/internal/services/media/media_services_account_resource_test.go @@ -340,7 +340,7 @@ resource "azurerm_key_vault_access_policy" "client" { key_vault_id = azurerm_key_vault.test.id tenant_id = data.azurerm_client_config.current.tenant_id object_id = data.azurerm_client_config.current.object_id - key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify"] + key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy"] secret_permissions = ["Get"] } From 511f39138f1d1534ee976110dc457173f8fb5c0d Mon Sep 17 00:00:00 2001 From: ziyeqf Date: Thu, 2 Mar 2023 13:53:08 +0800 Subject: [PATCH 3/5] update per comment --- internal/services/media/media_services_account_resource.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/services/media/media_services_account_resource.go b/internal/services/media/media_services_account_resource.go index 02afc4f63d32..d19549fc321d 100644 --- a/internal/services/media/media_services_account_resource.go +++ b/internal/services/media/media_services_account_resource.go @@ -523,10 +523,9 @@ func flattenMediaServicesAccountIdentity(input *accounts.MediaServiceIdentity) ( } func expandMediaServicesAccountKeyDelivery(input []interface{}) *accounts.KeyDelivery { - if len(input) == 0 { + if len(input) == 0 || input[0] == nil { return nil } - keyDelivery, ok := input[0].(map[string]interface{}) if !ok { return nil From c23a94d8e41619b1dd5e7ac5bbc8b4242b2b5369 Mon Sep 17 00:00:00 2001 From: Matthew Frahry Date: Thu, 2 Mar 2023 13:31:53 -0800 Subject: [PATCH 4/5] Update media_services_account_resource.go --- internal/services/media/media_services_account_resource.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/services/media/media_services_account_resource.go b/internal/services/media/media_services_account_resource.go index d19549fc321d..3890ac6a03df 100644 --- a/internal/services/media/media_services_account_resource.go +++ b/internal/services/media/media_services_account_resource.go @@ -526,10 +526,8 @@ func expandMediaServicesAccountKeyDelivery(input []interface{}) *accounts.KeyDel if len(input) == 0 || input[0] == nil { return nil } - keyDelivery, ok := input[0].(map[string]interface{}) - if !ok { - return nil - } + + keyDelivery := input[0].(map[string]interface{}) defaultAction := keyDelivery["default_action"].(string) var ipAllowList *[]string From 98a7f5ca4dbd261b3bbf600acc6114be97fdbace Mon Sep 17 00:00:00 2001 From: Matthew Frahry Date: Thu, 2 Mar 2023 13:36:02 -0800 Subject: [PATCH 5/5] Update media_services_account_resource.go --- internal/services/media/media_services_account_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/media/media_services_account_resource.go b/internal/services/media/media_services_account_resource.go index 3890ac6a03df..5a9e22f85057 100644 --- a/internal/services/media/media_services_account_resource.go +++ b/internal/services/media/media_services_account_resource.go @@ -526,7 +526,7 @@ func expandMediaServicesAccountKeyDelivery(input []interface{}) *accounts.KeyDel if len(input) == 0 || input[0] == nil { return nil } - + keyDelivery := input[0].(map[string]interface{}) defaultAction := keyDelivery["default_action"].(string)