From b67456e0186b87556535aac9040ae840304d791d Mon Sep 17 00:00:00 2001 From: ReenuSaluja Date: Wed, 29 May 2019 12:14:46 +0530 Subject: [PATCH 1/4] Fix #3021 --- azurerm/resource_arm_api_management.go | 12 ++++++------ azurerm/resource_arm_api_management_test.go | 2 +- website/docs/r/api_management.html.markdown | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/azurerm/resource_arm_api_management.go b/azurerm/resource_arm_api_management.go index b8a0b4f7aee3..92f009a02a6f 100644 --- a/azurerm/resource_arm_api_management.go +++ b/azurerm/resource_arm_api_management.go @@ -22,7 +22,7 @@ var apimBackendProtocolTls11 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Sec var apimFrontendProtocolSsl3 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30" var apimFrontendProtocolTls10 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10" var apimFrontendProtocolTls11 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11" -var apimTripleDesChipers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168" +var apimTripleDesCiphers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168" func resourceArmApiManagementService() *schema.Resource { return &schema.Resource{ @@ -193,7 +193,7 @@ func resourceArmApiManagementService() *schema.Resource { Optional: true, Default: false, }, - "disable_triple_des_chipers": { + "disable_triple_des_ciphers": { Type: schema.TypeBool, Optional: true, Default: false, @@ -891,7 +891,7 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str frontendProtocolSsl3 := false frontendProtocolTls10 := false frontendProtocolTls11 := false - tripleDesChipers := false + tripleDesCiphers := false if len(vs) > 0 { v := vs[0].(map[string]interface{}) @@ -901,7 +901,7 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str frontendProtocolSsl3 = v["disable_frontend_ssl30"].(bool) frontendProtocolTls10 = v["disable_frontend_tls10"].(bool) frontendProtocolTls11 = v["disable_frontend_tls11"].(bool) - tripleDesChipers = v["disable_triple_des_chipers"].(bool) + tripleDesCiphers = v["disable_triple_des_ciphers"].(bool) } return map[string]*string{ @@ -911,7 +911,7 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str apimFrontendProtocolSsl3: utils.String(strconv.FormatBool(frontendProtocolSsl3)), apimFrontendProtocolTls10: utils.String(strconv.FormatBool(frontendProtocolTls10)), apimFrontendProtocolTls11: utils.String(strconv.FormatBool(frontendProtocolTls11)), - apimTripleDesChipers: utils.String(strconv.FormatBool(tripleDesChipers)), + apimTripleDesCiphers: utils.String(strconv.FormatBool(tripleDesCiphers)), } } @@ -924,7 +924,7 @@ func flattenApiManagementCustomProperties(input map[string]*string) []interface{ output["disable_frontend_ssl30"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolSsl3) output["disable_frontend_tls10"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls10) output["disable_frontend_tls11"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls11) - output["disable_triple_des_chipers"] = parseApiManagementNilableDictionary(input, apimTripleDesChipers) + output["disable_triple_des_ciphers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) return []interface{}{output} } diff --git a/azurerm/resource_arm_api_management_test.go b/azurerm/resource_arm_api_management_test.go index 02516f921ee3..c9b893aacecc 100644 --- a/azurerm/resource_arm_api_management_test.go +++ b/azurerm/resource_arm_api_management_test.go @@ -399,7 +399,7 @@ resource "azurerm_api_management" "test" { security { disable_frontend_tls10 = true - disable_triple_des_chipers = true + disable_triple_des_ciphers = true } } `, rInt, location, rInt) diff --git a/website/docs/r/api_management.html.markdown b/website/docs/r/api_management.html.markdown index 76232a4897e5..13c1fde22afa 100644 --- a/website/docs/r/api_management.html.markdown +++ b/website/docs/r/api_management.html.markdown @@ -179,7 +179,7 @@ A `security` block supports the following: -> **info:** This maps to the `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` field -* `disable_triple_des_chipers` - (Optional) Should the `TLS_RSA_WITH_3DES_EDE_CBC_SHA` cipher be disabled for alL TLS versions (1.0, 1.1 and 1.2)? Defaults to `false`. +* `disable_triple_des_ciphers` - (Optional) Should the `TLS_RSA_WITH_3DES_EDE_CBC_SHA` cipher be disabled for alL TLS versions (1.0, 1.1 and 1.2)? Defaults to `false`. -> **info:** This maps to the `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` field From d6684434f5c86cf721c8b1691bf3c7373e2d2fa4 Mon Sep 17 00:00:00 2001 From: kt Date: Fri, 31 May 2019 12:37:48 -0700 Subject: [PATCH 2/4] fix --- azurerm/resource_arm_api_management.go | 27 ++++++++++++++++++--- azurerm/resource_arm_api_management_test.go | 3 ++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/azurerm/resource_arm_api_management.go b/azurerm/resource_arm_api_management.go index 92f009a02a6f..19ac053263da 100644 --- a/azurerm/resource_arm_api_management.go +++ b/azurerm/resource_arm_api_management.go @@ -30,6 +30,7 @@ func resourceArmApiManagementService() *schema.Resource { Read: resourceArmApiManagementServiceRead, Update: resourceArmApiManagementServiceCreateUpdate, Delete: resourceArmApiManagementServiceDelete, + Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -123,7 +124,7 @@ func resourceArmApiManagementService() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "location": locationSchema(), + "location": azure.SchemaLocation(), "gateway_regional_url": { Type: schema.TypeString, @@ -174,7 +175,7 @@ func resourceArmApiManagementService() *schema.Resource { "security": { Type: schema.TypeList, Optional: true, - Computed: true, + Computed: true, // todo remove in 2.0 ? MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -193,10 +194,19 @@ func resourceArmApiManagementService() *schema.Resource { Optional: true, Default: false, }, + "disable_triple_des_chipers": { + Type: schema.TypeBool, + Optional: true, + Computed: true, // todo remove in 2.0 + Deprecated: "This field has been deprecated in favour of the `disable_triple_des_ciphers` property to correct the spelling. it will be removed in version 2.0 of the provider", + ConflictsWith: []string{"security.0.disable_triple_des_ciphers"}, + }, "disable_triple_des_ciphers": { Type: schema.TypeBool, Optional: true, - Default: false, + // Default: false, // todo remove in 2.0 + Computed: true, // todo remove in 2.0 + ConflictsWith: []string{"security.0.disable_triple_des_chipers"}, }, "disable_frontend_ssl30": { Type: schema.TypeBool, @@ -901,7 +911,15 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str frontendProtocolSsl3 = v["disable_frontend_ssl30"].(bool) frontendProtocolTls10 = v["disable_frontend_tls10"].(bool) frontendProtocolTls11 = v["disable_frontend_tls11"].(bool) - tripleDesCiphers = v["disable_triple_des_ciphers"].(bool) + //tripleDesCiphers = v["disable_triple_des_ciphers"].(bool) //restore in 2.0 + } + + if c, ok := d.GetOkExists("security.0.disable_triple_des_ciphers"); ok { + tripleDesCiphers = c.(bool) + } else if c, ok := d.GetOkExists("security.0.disable_triple_des_chipers"); ok { + tripleDesCiphers = c.(bool) + } else { + tripleDesCiphers = false } return map[string]*string{ @@ -924,6 +942,7 @@ func flattenApiManagementCustomProperties(input map[string]*string) []interface{ output["disable_frontend_ssl30"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolSsl3) output["disable_frontend_tls10"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls10) output["disable_frontend_tls11"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls11) + output["disable_triple_des_chipers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) // todo remove in 2.0 output["disable_triple_des_ciphers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) return []interface{}{output} diff --git a/azurerm/resource_arm_api_management_test.go b/azurerm/resource_arm_api_management_test.go index c9b893aacecc..2f577652130b 100644 --- a/azurerm/resource_arm_api_management_test.go +++ b/azurerm/resource_arm_api_management_test.go @@ -476,7 +476,8 @@ resource "azurerm_api_management" "test" { } security { - disable_backend_tls11 = true + disable_backend_tls11 = true + disable_triple_des_ciphers = true } hostname_configuration { From a181fca73fb521acd51cd8c23ef9195e5fa5f385 Mon Sep 17 00:00:00 2001 From: kt Date: Fri, 31 May 2019 12:49:44 -0700 Subject: [PATCH 3/4] fix linting --- azurerm/resource_arm_api_management.go | 2 -- azurerm/resource_arm_api_management_test.go | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/azurerm/resource_arm_api_management.go b/azurerm/resource_arm_api_management.go index 19ac053263da..740d52c05b9d 100644 --- a/azurerm/resource_arm_api_management.go +++ b/azurerm/resource_arm_api_management.go @@ -918,8 +918,6 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str tripleDesCiphers = c.(bool) } else if c, ok := d.GetOkExists("security.0.disable_triple_des_chipers"); ok { tripleDesCiphers = c.(bool) - } else { - tripleDesCiphers = false } return map[string]*string{ diff --git a/azurerm/resource_arm_api_management_test.go b/azurerm/resource_arm_api_management_test.go index 2f577652130b..717da5098756 100644 --- a/azurerm/resource_arm_api_management_test.go +++ b/azurerm/resource_arm_api_management_test.go @@ -490,7 +490,7 @@ resource "azurerm_api_management" "test" { } proxy { - host_name = "api2.terraform.io" + host_name azurerm/resource_arm_api_management.go:904 = "api2.terraform.io" certificate = "${filebase64("testdata/api_management_api2_test.pfx")}" certificate_password = "terraform" negotiate_client_certificate = true From 0e2bb95873ce0528cc04673c63d43ee0cb255162 Mon Sep 17 00:00:00 2001 From: kt Date: Fri, 31 May 2019 13:13:46 -0700 Subject: [PATCH 4/4] fix typo --- azurerm/resource_arm_api_management_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_api_management_test.go b/azurerm/resource_arm_api_management_test.go index 717da5098756..2f577652130b 100644 --- a/azurerm/resource_arm_api_management_test.go +++ b/azurerm/resource_arm_api_management_test.go @@ -490,7 +490,7 @@ resource "azurerm_api_management" "test" { } proxy { - host_name azurerm/resource_arm_api_management.go:904 = "api2.terraform.io" + host_name = "api2.terraform.io" certificate = "${filebase64("testdata/api_management_api2_test.pfx")}" certificate_password = "terraform" negotiate_client_certificate = true